可能重复:
我需要关闭 std::fstream 吗?
int main() {
ofstream a("a.txt");
a << "A" << endl;
//a.close();
}
这工作正常,但不需要在程序结束时关闭文件吗?
可能重复:
我需要关闭 std::fstream 吗?
int main() {
ofstream a("a.txt");
a << "A" << endl;
//a.close();
}
这工作正常,但不需要在程序结束时关闭文件吗?