在文档类的Serialize(CArchive& ar)函数中写上
ar<<mydata;
此时保存的文件名是什么,文件保存在什么目录下?

解决方案 »

  1.   

    ar<<并不直接保存文件,而是ar关联了一个文件CArchive(
       CFile* pFile,
       UINT nMode,
       int nBufSize = 4096,
       void* lpBuf = NULL 
    );
    Example code:
    extern char* pFileName;
    CFile f;
    char buf[512];
    if( !f.Open( pFileName, CFile::modeCreate | CFile::modeWrite ) ) {
       #ifdef _DEBUG
          afxDump << "Unable to open file" << "\n";
          exit( 1 );
       #endif
    }
    CArchive ar( &f, CArchive::store, 512, buf );
      

  2.   

    如果需要修改文件类的保存文件的行为,请重载
    virtual BOOL OnSaveDocument(
       LPCTSTR lpszPathName 
    );
      

  3.   

    http://www.vczx.com/forum/showthread.php?threadid=10372