CFile   theFile;
theFile.Open(Path,CFile::modeWrite);
CArchive   ar(&theFile,CArchive::store);
for(int i=0;i<m_ncnt;i++)   
{   
   Path.Format("%d\r\n",m_fsize[i]);
   ar<<Path;
}
   ar.Close();   
   theFile.Close();m_fsize[]是个int数组,写入文件显示为:
=5863
=4315
=8650
=9755
>10393
>14446
=6991
=5595请问前面为什么会出现">"和"=",怎么解决?

解决方案 »

  1.   

    看看Path.Format之后,字符串path的值吧。
    msdn里面有这样一句,
    The call will fail if the string object itself is offered as a parameter to Format. For example, the following code:CString str = "Some Data";
    str.Format("%s%d", str, 123);   // Attention: str is also used in the parameter list.你试试,重新定义一个str,来格式吧,不要用path了。
      

  2.   

    这个应该是保存格式的问题,如果你要保存为可读的文本格式,用WriteString吧。我记得是这样。
      

  3.   

    实际上,你这样保存结束以后,用相对应的读取方式(>>)是可以把Path的串读出来的,只是你自己打开文件时看到的文本不对而已。
      

  4.   

    用WriteString函数就可以存为正常的可视文本了。应该是。
      

  5.   

    writestring 不是cfile类里的吧?不能用呀
      

  6.   

    是CAchive类啊,你不是用CAchive ar保存吗?
    直接ar.WriteString。