Link to home
Start Free TrialLog in
Avatar of mhd-it
mhd-it

asked on

Write and read an object in binary file

hi there
i wanna to write and read a complex data as a binary ..in and from a binary file
thanks
Avatar of imladris
imladris
Flag of Canada image

You can write an integer to a file by opening an output file stream, and then writing the integer to it. Something like:

#include <fstream>

ofstream fout;

int i=233;
fout.open("data");
fout<<i;
fout.close();

Reading it back in is the analogous process with an file input stream.
ASKER CERTIFIED SOLUTION
Avatar of Exceter
Exceter
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of burcarpat
burcarpat


  http://www.parashift.com/c++-faq-lite/serialization.html

will give you a head start.  also check out serialization12.zip under

    http://groups.yahoo.com/group/boost/files/

-- ba
Did any of those responses help?

If any did, you should select the response(s) that helped you, and grade it (them).

If not, perhaps a clarifying question would help.
Avatar of mhd-it

ASKER

thanks for all guys ..who's help me
You are most welcome.