Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

debugging with visual studio using redirected standard input

Tags:

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.

like image 676
user1930362 Avatar asked Dec 26 '12 17:12

user1930362


People also ask

What is Stdin redirection?

Redirection is a feature in Linux such that when executing a command, you can change the standard input/output devices. The basic workflow of any Linux command is that it takes an input and give an output. The standard input (stdin) device is the keyboard. The standard output (stdout) device is the screen.


1 Answers

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.

like image 185
Hans Passant Avatar answered Sep 17 '22 04:09

Hans Passant