C++ – How to pipe output when debugging in Visual Studio 2008

cvisual studio

I tried going to project properties, selected debugging under configuration properties, and set command arguments to "> out.txt" (without quotation marks of course). However, when I run the program (with F5) I still see output on the console, and no out.txt file is created. This is just a simple C++ Hello World program. These steps worked for my friend but not for me (he's using VS2008 also). I've heard of disabling the hosting process but it seems that's just for Visual Studio 2005.

It appears that "> out.txt" is being passed in as an argument. argc is 3, argv[1] is ">", and argv[2] is "out.txt". Is this not supposed to happen? What can I do to fix it?

Best Answer

According to this bug report on the Microsoft Connect website, this issue was fixed in Visual Studio 2008 Service Pack 1. I'm running VS2008 SP1 on my system, and output redirection works OK for me. You can download SP1 here.