How can I output output when debugging in Visual Studio?
3 answers
You can redirect using the "command argument" in the project properties.
You can also redirect stdout / err / in from your program. find a pattern in C ++ later on, the only advantage over the first simpler solution is portability.
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main ()
{
#ifdef _DEBUG
ofstream mout("stdout.txt");
cout.rdbuf(mout.rdbuf());
#endif
cout<< "hello" ;
return 0;
}
+1
source to share