I am using microsoft visual studio to do C++. I don't see std::err and std::out in the output console of the IDE. Is there a way to redirect them ?
You can indeed redirect std::out and std::err. Simply right click on your project in the solution explorer and select Properties
. Then select Configuration Properties -> Debugging
and put the appropriate arguments into the Command Arguments
field. For example, to redirect std::err to a file, I would type in 2> ErrorLog.txt
.
The things you type in Command Arguments
simply get appended as command line arguments when Visual Studio runs your program, just like you had manually typed them in to the console. So, the above example simply tells VisualStudio to run your program with the command <programName>.exe 2> ErrorLog.txt
instead of just <programName>.exe
.