Hi all,
I'm trying to write some double precision digits to a file, here's what I'm doing:
either of the write instructions gives me the same problem - dd is written to the file, but throughout the file there are unexplained extra pairs of bytes interspersed, specifically "10" "13" (i.e. lf/cr IF we were talking about ASCII). So when I try to read the data in a different application later on it's all screwed up (although if I read back from the file in the same program it does so correctly). I can't figure out what the pattern is to where the bytes appear, but what I expect to be a 1,600,016 byte file ends up as 1,602,774 bytes. Anybody have any ideas? Thanks in advance.
I'm trying to write some double precision digits to a file, here's what I'm doing:
Code:
typedef basic_ofstream< double, char_traits<double> > d_ofstream;
d_ofstream myfile("myfile.dat");
double dd[N];
... some processing that fills in the values of dd ...
for(i=0;i<N;i++)
myfile.put(dd[i]); OR myfile << dd[i];
myfile.close();