R
Ronny Mandal
Hi.
Assume you have a file with the format
1.2 4.2
4.3 2.9
i.e
double[space]double
double[space]double
....
Then assume you want to read this with a c-program.
fscanf(ifile, "%lf%lf", &x, &y); where ifile is a file-pointer will do the
job.
But if you want to read binary, with e.g fread, is there a way to read the
two variables the same way? Or do I have to do something like this:
fread( ( void* ) &temp, sizeof( temp ), 1, ifile );
x = temp;
fread( ( void* ) &temp, sizeof( temp ), 1, ifile );
y=temp;
where x,y and temp are double.
--
Thanks in advance,
Ronny Mandal
Assume you have a file with the format
1.2 4.2
4.3 2.9
i.e
double[space]double
double[space]double
....
Then assume you want to read this with a c-program.
fscanf(ifile, "%lf%lf", &x, &y); where ifile is a file-pointer will do the
job.
But if you want to read binary, with e.g fread, is there a way to read the
two variables the same way? Or do I have to do something like this:
fread( ( void* ) &temp, sizeof( temp ), 1, ifile );
x = temp;
fread( ( void* ) &temp, sizeof( temp ), 1, ifile );
y=temp;
where x,y and temp are double.
--
Thanks in advance,
Ronny Mandal