<pre name="code" class="cpp">#include <iostream>
#include <fstream>
using namespace std;
void main()
{
ifstream infile;
infile.open("test.txt");
if (!infile.is_open())
{
cerr << "文件打开失败!" << endl;
exit(EXIT_FAILURE);
}
infile.close();
cout << "End of main!" << endl;
cin.get();
}
创建并打开文件
最新推荐文章于 2022-06-20 14:46:09 发布