Data files

What is the best way to save information stored in containers to data files? Can you store a vector as one block of a file then read it back that way?
Should be able to use fstream's.
ofstream to save it, ifstream to load it.
Can't be too certain, I've never tried, but it works with everything else.
Look up serialization.
The only data type that can be easily, safely, and portably saved to a file is a byte buffer.
OK I looked it up and put the code in, but the compiler doesn't seem to recognize the [Serializable] that I put in front of it. The site didn't say anything about including anything extra?
helios, looks like he added the .NET framework code thinking it was talking about Windows programs.
ok, so I can't do this kind of thing with c++, I have to use a different compiler? Not sure which way to go here.
Did you read the article?
Here's a highlight: http://en.wikipedia.org/wiki/Serialization#C.2B.2B
-sigh- You CAN do this with C++. Using a different compiler IS using C++. YOU didn't read the article he linked properly. You need a new LIBRARY not a new COMPILER. They are completely different. I recommend using the links provided in that article to get the LIBRARY that you need.
thanks. It took a lot of reading, but I got the Boost library working, and learned a lot. Good deal.
Topic archived. No new replies allowed.