如何在文件中删除任意字符(不能用某些东西替换)?
#include <fstream>
int main()
{
std::fstream FileStream("MyFile.txt", ios_base::in | ios_base::out | ios_base::binary);
// For the sake of argument, MyFile.txt already has stuff in it.
FileStream.seekg(5);
FileStream.remove(); // Something like this.
}
答案 0 :(得分:5)
您有两种选择: