?
Solved

Howto debug console app using pipes

Posted on 2003-03-08
5
Medium Priority
?
246 Views
Last Modified: 2010-04-01
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
Comment
Question by:AssafLavie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 8095123
I'd start it from the command line and put a "DebugBreak()" statement in "main()" to launch the debugger...
0
 

Expert Comment

by:purplecabbage
ID: 8095233
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
 
LVL 4

Author Comment

by:AssafLavie
ID: 8095335
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
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
ID: 8095361
>>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
 
LVL 2

Expert Comment

by:bkrahmer
ID: 8095567
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question