When I use freopen, and then redirect to the console,I can't see any output
已回答
When I use freopen, and then redirect to the console, I can't get any output.


#include <iostream>
using namespace std;
int main() {
freopen("../hello.txt", "w", stdout);
cout << "Hello" << endl;
freopen("CON", "w", stdout);
cout << "HELLO WORLD" << endl;
system("pause");
return 0;
}
请先登录再写评论。
Hello!
You can try enabling the "Run in external console" option in your run/debug configuration (
Run | Edit Configurations...), it should help.