0
使用wfstream我想写一些处理内容从文件中删除旧内容。写新内容删除旧内容
wfstream cSrcFileOutput(m_cstrFile);
wfstream cSrcFileInput(m_cstrFile);
std::wstring cstrSrcFileContent;
....
cstrSrcFileContent有我的内容
我下面写:
cSrcFileOutput.write(cstrSrcFileContent.c_str(), cstrSrcFileContent.size()*sizeof(wchar_t));
的问题是它不清除以前的数据。相反,它会在文件的某个位置插入已处理的内容。
我想旧的内容替换为新的处理内容。
请建议。
[清除C++中的文本文件中的数据]的可能重复(http://stackoverflow.com/questions/17032970/clear-data-inside-text-file-in-c) –