Reputation:
For example, if I wanted to do it from the command line I would use "a.exe > out.txt". Is it possible to do something similar in Visual Studio when I debug (F5)?
Upvotes: 3
Views: 1912
Reputation: 1727
You can redirect using the "command argument" in the project properties.
You can redirect stdout/err/in from your program as well. find a sample in c++ hereafter the only advantage over the first simpler solution is to be portable.
#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;
}
Upvotes: 1
Reputation: 1708
Just checking, you are not looking for outputting within Visual Studio using stuff like
System.Diagnostics.Debug.WriteLine("this goes into the Output window");
right?
Upvotes: 1
Reputation: 10684
In project properties:
Upvotes: 4