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)?
+2
A:
In project properties:
- enter command line arguments "> out.txt"
- Disable the hosting process
Igal Serban
2008-11-28 23:29:44
+1
A:
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?
Kasper
2008-11-28 23:40:32
+1
A:
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;
}
call me Steve
2008-11-29 00:06:36