Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Capturing DOS output in C++
Name: Scott Date: December 27, 2001 at 11:50:58 Pacific
Comment:
Does anyone know how to get the output of a DOS program in C++. I have an old program that I use in DOS and I need to get the data it outputs, but I havn't found a good way to do it yet. So if anyone knows please let me know
Name: Xeon Date: December 27, 2001 at 15:45:08 Pacific
Reply:
Dunno if this helps. Can you manage to redirect STDOUT to your program? I think the stream libs supports this. Again, it's only a suggestion. I'm not too familiar with C++.
0
Response Number 2
Name: Richard Date: December 29, 2001 at 08:19:23 Pacific
Reply:
Hi Scott Just a thought The dos program that you are trying to pick up the output from Is it a program that you have writted ? Is it possable to redirect the output to a file ? e.g > text.doc
or does the information get displayed on the screen from within the program ?
if it is posble to re-drect the output to a file you may be able to read this information into the c++ program as normal
hope it helps
regards Richard
0
Response Number 3
Name: Scott Date: December 30, 2001 at 18:52:41 Pacific
Reply:
The program is not one that I have written. It displays the information on the screen as part of the program. When I call my program and it runs the dos program it will not let me capture the output using a cin command. After the dos program I get my prompt for input in my program. So I am wondering if there is a screen capture command that would read the screen and put it into some sort of string, from which I could get the needed information Scott
0
Response Number 4
Name: MacGyver Date: January 13, 2002 at 09:55:35 Pacific
Reply:
No, what the other guy meant was just do this at the dos prompt:
program.exe >>log.txt
just replace the program.exe with the name of the program you run, it will pipe the output to log.txt. use just > to make a new log.txt everytime.
Summary: I'm not sure I remember from my C++ days (which are quickly coming back to haunt me since my operating systems class is all C...), but do you need to escape the slash? c:\\mydir This question is asked...
Summary: ok guys, here is a question i have for you, if i want to execute dos commands in c++, what would i use? i'd really appreciate if you could answer this question, as batch files don't do everything i ne...
Summary: Is there a way to import the output from a dos program into a windows program in c++? I want to be able to show the status of the running program that is using dos but am not sure how to port it into ...