Use MFC's serialization mechanism to read and write the data in your program's documents. Build serialization support into your data classes. Or override MFC's serialization mechanism to store data your own way, perhaps in a database or in your own file format.
Writing data to and reading it from files is complicated because one C++ object can contain other objects or pointers to objects. Reading or writing the state of objects to persistent storage, such as a file, requires managing this complex web of objects. (For more information, see CArchive Tasks.)
MFC serialization is the default solution. When serialization doesn't suit your needs, you can trace through the call stack and pick a suitable place to override the mechanism, either to alter its behavior or to replace it with your own implementation.