Reputation: 191
I made a struct with CStrings in my MFC program. I also did a pointer so I can send it to my CMyDoc class. How can I save the variable, that the value stays after quitting the program?
Upvotes: 0
Views: 149
Reputation: 3874
Assuming that your CMyDoc is inherited from CDocument you need to override the Serialize method. More info available here:
Serializing Data to and from Files
The MFC Application Wizard places a skeletal override of the CDocument member function Serialize in the document class it creates for you. After you have implemented your application's member variables, you can fill in your Serialize override with code that sends the data to an "archive object" connected to a file. A CArchive object is similar to the cin and cout input/output objects from the C++ iostream library. However, CArchive writes and reads binary format, not formatted text.
Override the CObject::Serialize member function in your document class to write and read the document's data to and from disk.
Upvotes: 2