I need your help again for the save and read data in binary. I have, a vector<<complex> > xy(256) which is read from the hardware in 10 times:
vector<<complex> > xy(256);
ofstream outfile2 (outfilename2.c_str() , ofstream::binary);
....
....
for(unsigned t = 0; t < 10; t++)
{
     ....
     ....
     for(unsigned i = 0; i < 256; i++)
     {
           xy[i] = f[i] * conj(g[i]);
     }
     for(unsigned i = 0; i < 256; i++)
     {
           outfile2 << boost::format("%20.8e") % xy[i]<< endl;  // write in text
     }
}  // the text data will be 2560 lines of complex data, for example:
   // (6.69635350e+06,7.34146150e+06)
Now, I am trying to save into binary file, using this command:
for(unsigned i = 0; i < 256; i++)
     {
        outfile2.write((const char*)& xy[i], 1 * sizeof(complex<short>));
        outfile2.flush();
     }
Although, it still give me a data, but when i compare to the original text data, they were different. I do not understand why?
I would like to read complex 16 with floating point data.
I hope you guys can help.
Thank you very much.