• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

Howto debug console app using pipes

How can I use MSDEV to debug a console app by feeding it shell-pipes that are directed to the stdIO?
myprog <input >output
I want to be able to do that in VC but it doesn't work if I put "<input >output" into the 'program arguments' box...
0
AssafLavie
Asked:
AssafLavie
1 Solution
 
jkrCommented:
I'd start it from the command line and put a "DebugBreak()" statement in "main()" to launch the debugger...
0
 
purplecabbageCommented:
Does your program use stdout?
I assume you have put debug statements and don't see the standard output because you don't have a command window.

try redirecting to file:
> debug.txt

j.
0
 
AssafLavieAuthor Commented:
jkr, is there no proper way of doing it through the IDE? I mean, isn't that a pretty simple and common programming situation?

0
 
jkrCommented:
>>jkr, is there no proper way of doing it through the IDE?

The problem is that the redirection is done by teh shell, not the app itself. The proper way would be

cmd.exe /c myapp.exe < input > output

(or "command.com ..." respectively)

So, you would have to change the option "Executable for Debug Session" to the shell and set the rest as the "Program Arguments". *I* personally would use the breakpoint for simplicity's sake.
0
 
bkrahmerCommented:
I would suggest attacking the problem a different way.  I would try to duplicate the problem, and write test code that shows the failure.  That way you won't have to work with external input.  Check out a unit test framework like cppunit.

cheers,
brian
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now