Re: saving documents
I agree Joe's suggestion to use something standard like XML. It makes
reading and updating the file structure so much easier in the long run. XML
has become almost academic to create and parse.
You would also want to save the data that the pointers point to rather than
the pointers. That probably goes without saying, but I've seen people
serialize the pointers and then wonder what happened to their data.
An alternative to an XML file is a .INI file. There are lots of examples of
reading and writing to .INI files like:
http://www.codeproject.com/useritems/CIniFile.asp
Tom
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:1nni739mpjs7t1rd4tmh7b57tff1c26n42@4ax.com...
It doesn.t. In fact, it doesn't save the document at all. It opens a
file, calls the
serialize method, and closes the file. If you don't put something inthe
serialize method
to actually PUT something in that file, the file will be empty. So it is
up to you to
save what you need.
Note that you can invoke the << and >> methods to save data, although
frankly I find the
whole serialization mechanism more than a little suspect, and don't use
it at all; I
serialize by reading and writing files which are insensitive to schema
migration problems,
and I tend towards using XML these days.
joe
On Wed, 20 Jun 2007 15:59:04 -0000, wanwan <ericwan78@yahoo.com> wrote:
if I add pointers to the document class as member variables, how does
mfc save the data when I save the document at runtime?
I'm worried addresses are saved rather than the actual data.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm