我正在尝试测试freopen("inputs.txt","r",stdin);
,但它不起作用。下面是我的代码:
#include <iostream>
using namespace std;
int main() {
freopen("inputs.txt","r",stdin);
int n;
cin >> n;
cout << n << endl;
return 0;
}
我的输入文件中只有一个整数,并且在同一目录中。
任何人都可以帮忙吗?