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请问前面为什么会出现">"和"=",怎么解决?
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请问前面为什么会出现">"和"=",怎么解决?
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了。
直接ar.WriteString。