CFile f;
if(f.Open(strPath,CFile::modeWrite|CFile::modeCreate))
{
CArchive ar(&f,CArchive::store);
ar.m_pDocument=this;
TRY
{
CWaitCursor wait;
Serialize(ar);
ar.Close();
f.Close();
}
CATCH (CMemoryException, e)
{
ar.Close();
AfxMessageBox("文件存储异常");
}
END_CATCH
}
CArchive 用序列化的方式来保存文件,是CFile类的一个辅助类。