Following is a sample code:
CFile serFile;
serFile.Open(_T("Person.ser"), CFile::modeCreate | CFile::modeWrite);
CArchive writer(&serFile, CArchive::store);
me.Serialize(writer);
writer.Close();
serFile.Close();
serFile.Open(_T("Person.ser"), CFile::modeRead);
CArchive reader(&serFile, CArchive::load);
CPerson clone;
clone.Serialize(reader);
reader.Close();
serFile.Close();
Here, I have a writer
which archives the object me
. Then, I use another CArchive
object reader
to un-archive it. Is it possible to re-construct or set any property of writer
to make it, the reader instead of declaring another CArchive
object reader
?
Thanks.