我正在尝试使用文件创建程序,当我使用ofstream或ifstream时,Visual Studio表示ofstream和ifstream是未定义的。有人可以解释一下吗?
#include <iostream>
#include <fstream>
int main()
{
ofstream file("Test.txt", std::ios::app);
file << "File successfully made\n";
file.close();
return 0;
}
即使这根本不起作用。
ofstream
is in the namespacestd
, so you need to specify that.