debugging with visual studio using redirected standard input

巧了我就是萌 提交于 2019-11-28 06:32:01
Hans Passant

This is a supported debugging scenario. You do have to make sure that the debugger can find the file. Leave the Command setting at $(TargetPath). A possible value for the Command Arguments setting is:

 < "$(ProjectDir)test.txt"

if the input file "test.txt" is located in the project directory. Or type the full path of the file to be sure. The MSDN article that describes this feature is available here.

I just create a file called stdin.txt in the project 1) set the Build Action to Content 2) Copy to Ouput Directory: Copy if newer

Then when you build stdin.txt is copied to the same folder as the executable.

Then in project properties debug|command line arguements enter the following < stdin.txt

There is no need to use a path macro

If you don't want to mess with the the path you can add a new file with a right click on the source files folder in the solution explorer and then paste to it the content from the wanted file. And then change the command argument to the new file name.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!