Serialization and deserialization
stackoverflow Is it possible to serialize and deserialize a class in C++?
I recommend Google protocol buffers.
I wrote an article describing a rudimentary (but still powerful) serialization system. You may find it interesting: Using SQLite as an On-disk File Format, Part 2.
I encourage anyone who has access to C++11 to take a look at cereal, a C++11 header only library for serialization that supports binary, JSON, and XML out of the box. cereal was designed to be easy to extend and use and has a similar syntax to Boost.
The Boost::serialization
library handles this rather elegantly. I've used it in several projects. There's an example program, showing how to use it, here.