J
jimG
Hi, everyone,
I need to read a file with long (double precision) floating point
numbrers.
On the console, >od -N80 -tf8 -w32 a.bin reads the first ten numbers
correctly without any trouble.
The first number prints out as 7.50000000000000e+00, for example, which
is correct.
(The second one is 2.659273227531892e-20. And so on.)
My problem is trying to read them into a C program. I've tried all
kinds of stuff with fscanf and fread, but I can't get anything sensible
to read in. I've opened the file as rb with fopen. My best tries so
far:
float cc[8];
fscanf(fileptr,"%le",&cc);
or
fread(&cc,8,1,fileptr);
So far I am just trying to readin the first number.
Obviously, I'm doing something wrong.
I've read the faq, but I'm still lost.
Any help will be greatly appreciated.
TIA.
Jim G
I need to read a file with long (double precision) floating point
numbrers.
On the console, >od -N80 -tf8 -w32 a.bin reads the first ten numbers
correctly without any trouble.
The first number prints out as 7.50000000000000e+00, for example, which
is correct.
(The second one is 2.659273227531892e-20. And so on.)
My problem is trying to read them into a C program. I've tried all
kinds of stuff with fscanf and fread, but I can't get anything sensible
to read in. I've opened the file as rb with fopen. My best tries so
far:
float cc[8];
fscanf(fileptr,"%le",&cc);
or
fread(&cc,8,1,fileptr);
So far I am just trying to readin the first number.
Obviously, I'm doing something wrong.
I've read the faq, but I'm still lost.
Any help will be greatly appreciated.
TIA.
Jim G