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) –