下一个程序有什么问题?我希望文件能够到达结尾。
ifstream file("main.cpp", ios::binary | ios::ate);
if (file) {
//fstream::pos_type size = file.tellg();
file.seekg(100, fstream::cur);
if (file.eof()) {
cout << "eof is true\n";
}
}
fstream 到达文件末尾时,为什么没有输出 "eof is true"?