C++ FAQ Celebrating Twenty-One Years of the C++ FAQ!!!
(Click here for a personal note from Marshall Cline.)
Section 15:
[15.14] How can I write/read objects of my class to/from a data file?

Read the section on object serialization.