Here's a summary of how to serialize the data in a CDocument class.
Use the Resource Editor to change the document string to use a distinctive file extension for your files.
If your document has any data members that are instances of a class cMyClass which you wrote, define the cMyClass as a child of CObject (or as a child of some other class which inherits from CObject ) and add the DECLARE_SERIAL and IMPLEMENT_SERIAL macros to, respectively, the cMyClass definition in the *.h file and the cMyClass implementation in the *.cpp file.
Override the cMyClass::Serialize(CArchive &ar) method so that it writes and reads the data members of cMyClass, according to whether or not ar.IsStoring() is TRUE. Be sure to write and read the data members in the exact same order. Use the standard extraction and insertion operators to write and read simple types.
If your document has an array member that holds an array of pointers to your cMyClass objects, declare the array type as CTypedPtrArray<CObArray, cMyClass*>.
Override your CDocument::Serialize. First use overridden Serialize calls inside it to serialize embedded class objects or arrays, and follow this with code that uses ar.IsStoring()to decide whether to write or read, and which uses the standard extraction and insertion operators to write and read simple types.