使用重定向的标准输入在Visual Studio中进行调试 [英] debugging with visual studio using redirected standard input

查看:214
本文介绍了使用重定向的标准输入在Visual Studio中进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio调试c ++控制台应用程序.每次调试该程序时,我都花了相同的输入.我想多次使用相同的输入.

我这样做时无需在命令行中使用以下命令进行调试:Program.exe< 1.在

是否可以将调试与从文件重定向的标准输入一起使用?

我已经尝试过查找属性.我尝试将Command设置为$(TargetPath)< 1.in代替$(TargetPath). 我还尝试将Command Arguments设置为<. 1.英寸这些方法完全无效.

我正在使用Visual Studio2012.但这在所有版本的Studio中可能都是相同的.

解决方案

这是受支持的调试方案.您必须确保调试器可以找到该文件.将命令设置保留在$(TargetPath). 命令参数"设置的可能值是:

 < "$(ProjectDir)test.txt"

如果输入文件"test.txt"位于项目目录中.或键入文件的完整路径以确保. 在此处可用.在此处可用./p>

I am debugging c++ console application with Visual studio. I exhausted of inserting the same input every time I debug this program. I would like to use the same input more times.

I do this without debugging in command line with command: Program.exe < 1.in

Is it possible to use debugging with standard input redirected from file???

I already tried looking in to procejt properties. I tried setting Command to $(TargetPath) < 1.in instead of $(TargetPath). I also tried setting Command Arguments to < 1.in. Niether of these method worked.

I am using Visual Studio 2012. But this is probably same in all versions of studio.

解决方案

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.

这篇关于使用重定向的标准输入在Visual Studio中进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆