Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Take info from a DOS window and send other info back

Status
Not open for further replies.
Sep 29, 2002
2
US
First of all let me say that I am absolutely a newbie to C++ programming. I know what I want to do but haven't a clue how to code. What I'm hoping to accomplish is to find someone (or a forum) to get the pieces of the puzzle and learn while I build. I'm not looking to take classes so I can start building this "app" in a couple of years. Nor am I looking to take advantage of anyone, I just want to get a good jump start on learning C++ and having a project that will propagate that.

Well in a nutshell I want to build a Windows "app" (using C++Builder 6) that will allow me to monitor a DOS (NT CMD) window, line by line (line wrapping my be involved), that will have information updating constantly. Each line will be analyzed and when certain information is detected the "app" will send commands back into the DOS (NT CMD) window.

TIA,

Fossil Rock
 
This solution is a Unix concept: I don't know whether it will work on NT or not. I only have Win95/98 so I don't know what works on NT and what doesn't. Say the program you wish to monitor is WATCHED. On Unix, the way you'd do this is

On one terminal/cmd prompt
WATCHED > watched.out

On another terminal/cmd prompt
Open watched.out and read it.

If you start hitting sharing problems, you could try

WATCHED | tee watched.out

where tee.exe is a program that copies stdin to the filename given in the first parameter.
 
I had the same problem a few weeks ago and I haven't found a good method of redirecting i/o yet.
I tried this code:
but it I could not figure out how to make it work with a progress indicator in dos. I mean a program that prints information on the same line using "\r".
I hope you have plenty of information to study now :)
If you find a a code snippet that does what we want please post a link in this thread.

best of luck,
Hennie Peters
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top