CStirng str="test";
CFile fileout(strFilePath, CFile::modeCreate|CFile::modeWrite|CFile::modeNoTruncate);
fileout.SeekToEnd();
fileout.Write(str,str.GetLength());
fileout.Close();
本文展示了一个使用 CFile 类将 CString 对象写入文件的示例。通过设置文件操作模式并利用 SeekToEnd 方法定位到文件末尾,确保字符串被追加而非覆盖原有内容。
CStirng str="test";
CFile fileout(strFilePath, CFile::modeCreate|CFile::modeWrite|CFile::modeNoTruncate);
fileout.SeekToEnd();
fileout.Write(str,str.GetLength());
fileout.Close();

被折叠的 条评论
为什么被折叠?