
MFC Serialize: sometimes OK, sometimes not!
What do you mean didn't work? What type of variables are you using? I'm
guessing array[]. If they are you will have to use ar.Write() and ar.Read()
since CArchive doesn't handle arrays. Have you stepped through the code in
both cases to see what's in the variables?
Quote:
> I have a simple SDI program that tries to save and re-open
> a 2-variable file with the following code. It didn't work,
> so I reconstructed it and it worked. Then I tried again
> and it didn't work. Is there some required developmental
> sequence that I'm missing here? Or a problem with Serialize?
> void CTestDoc::Serialize(CArchive& ar)
> { if (ar.IsStoring())
> { ar << m_szTest1;
> ar << m_szTest2;
> }
> else
> { ar >> m_szTest1;
> ar >> m_szTest2;
> }
> }