Document - Save to file. How? 
Author Message
 Document - Save to file. How?

Hello! Dear ppl:
I have some variables in my CDocument class, which I'd like to save on disk and/or open with Serialization & CArchive.
I just don't know what to do next:
void CCrosswordDoc::Serialize(CArchive& ar)
{
        if (ar.IsStoring())
        {
                // TODO: add storing code here
                ar << m_Block;
                ar << m_horizontal;
                ar << m_vertical;
        }
        else
        {
                // TODO: add loading code here
                ar >> m_Block;
                ar >> m_horizontal;
                ar >> m_vertical;
        }

Quote:
}

As well as I can understand I've to add CFile object in my CDocument and also CArchive object....but if I've to create
new CArchive what is the purpose of Serialization method??? It seems MFC already create CArchive if can pass me ar
reference...???
I've look around for examples how to make it but can't find exactly what I want. Please send me some examples how to
make it.

Thanx a LOT!!!!

-----------------** -- Posted from CodeGuru -- **-----------------
http://www.*-*-*.com/ ;  The website for Visual C++ programmers.



Thu, 06 Sep 2001 03:00:00 GMT  
 Document - Save to file. How?
Natasha, your code looks right, so you shouldn't have to do anything else.
You definitely don't have to create CArchive and CFile objects, the
framework will do that for you.  What happens when you try to save to a
file and then open the file?

What types are the variables you are saving in Serialize()?  Are they
descended from CObject?

John



Fri, 14 Sep 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Document - Save to file. How?

2. save as document instead of file

3. Saving a document with multiple file extensions

4. Saving files, document/view

5. How do I stop Compound Document files from growing on save

6. Save A Document in Two Separate Files

7. Document template icon doesn't appear with my saved file

8. Saving Active documents to a file

9. Saving a document in two different files

10. Help: difference of document handling between saving and discarding a document

11. Basic Open File, Save/ Save as functions for dos word processor

12. ! Saving (graphics) to file - saving window contents (PICT) in Code warrior C (on a Mac PPC)

 

 
Powered by phpBB® Forum Software