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

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

问题描述

我正在使用 Visual Studio 调试 C++ 控制台应用程序.每次调试这个程序时,我都厌倦了插入相同的输入.我想多次使用相同的输入.

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.

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

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???

我已经尝试查看 procejt 属性.我尝试将 Command 设置为 $(TargetPath) <1.in 而不是 $(TargetPath).我还尝试将命令参数设置为 <1.in.这些方法都没有奏效.

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.

我使用的是 Visual Studio 2012.但这在所有版本的 Studio 中可能都一样.

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

推荐答案

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

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"

如果输入文件test.txt"位于项目目录中.或者输入文件的完整路径来确定.描述此功能的 MSDN 文章在此处提供.

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天全站免登陆