问题
I have the following in Debugging | Command arguments -a start.ini > c:\temp\a.out
The argc is 3 as expected but is 5 in one of my collegues machine- it seems as if the redirection operator is taken as an arguemtnt on his box. Is there any setting to fix this ?
回答1:
Redirection support in the "Debugging|Command Arguments" project setting was broken in Visual Studio at some point, but I'm not sure exactly which releases that's true for (http://connect.microsoft.com/VisualStudio/feedback/details/333493/cant-redirect-stdin-stdout-for-debugging). From the sketchy information I've found, it seem like it worked though VS2005. was broken in some versions/releases (but maybe not all updates) of VS2008, and is working in VS2010.
You might want to make sure you and your colleague are running the same version of Visual Studio (including service Packs).
Redirection in the "Debugging|Command Argument" setting is working OK right now for me with VS 2010.
回答2:
I just ran into this problem while debugging a legacy product in VS2008 with Intel Visual Fortran 11.1. Redirection of stdin and stdout for debugging was fixed in Service Pack 1.
Here's a list of issues fixed in Visual Studio 2008 Service Pack 1, including this one:
Connect ID | Description 333493 | You cannot redirect an application by using standard input (STDIN) and standard output (STDOUT) for debugging.
来源:https://stackoverflow.com/questions/3054421/visual-studio-2008-debugger-command-line-arguements