On storing tick data in binary files with C++

I find trying to lay out data files with the C++ IOStream stuff to be like pulling teeth. Good old fashioned unix read() and write() is much less painful, especially for binary formats. For text formats printf()/scanf() are king. But that's just me.

I'm sure that IOStream has a mode for sending and reading raw bytes. Use that.
 
Quote from bellman:

Okay, this might sound like a dumb question, but I've been banging my head. How do I read the data in the binary file back into a type double?

I've tried with the ifstream class read function and posted to DaniWeb http://www.daniweb.com/forums/thread311612.html , but I don't have a solution. Can anyone help me out?
not too much different than how you wrote to file:
Code:
double myData;
ifstream infile("data.bin", ios::in|ios::binary);
infile.read((char*)&myData, sizeof myData);
@bigD: like pulling teeth?... care to show a simpler version using read()?
 
Back
Top