|
-
Jun 18th, 2002, 10:11 PM
#1
Thread Starter
Addicted Member
Reading an indeterminate # of floats into an array
I want to read in an indeterminate number of double values from a file into an array, I created the double array with :
<code>
#include <Afxtempl.h>
typedef CArray <double, double> CDoubleArray;
CStdioFile data;
CDoubleArray datarray;
data.Open("datafile2.txt",CFile::modeRead|CFile::shareExclusive);
<code/>
Can anyone take it from here? The file looks ".23 .44 .32..."
here is what I was doing before with a C style IO but I need to use MFC now
<code>
#include <Afxtempl.h>
typedef CArray <double, double> CDoubleArray;
CDoubleArray datarray;
CFile * data;
double tem;
data = fopen("datafile2.txt","r");
while(fscanf(data,"%lf",&tem) != EOF)
dataarray.Add(tem);
<code/>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|