- 分享
文件读写, freopen的用法
- 2023-3-11 10:51:16 @
#include <bits/stdc++.h>
/*
如果题目要求文件输入输出
比如说输入文件是test.in, 输出文件是test.out
你需要在主函数内添加
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
*/
using namespace std;
int main()
{
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
return 0;
}
1 comments
-
狄清越 LV 7 @ 2023-3-12 19:45:31
最后要关闭, fclose(stdin); fclose(stdout);
- 1