On storing tick data in binary files with C++

Discussion in 'Data Sets and Feeds' started by bellman, Sep 13, 2010.

  1. 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.
     
    #11     Sep 15, 2010
  2. 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()?
     
    #12     Sep 15, 2010
  3. bellman

    bellman

    Thank you prop seeker. Nothing wrong with the good ol' STL is there?
     
    #13     Sep 17, 2010