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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

capture output from dosbox

Status
Not open for further replies.

hennep

Programmer
Dec 10, 2000
429
I want to start a dos program and use the output (both stdout and stderr) in a cbuilder program.
I have seen an example on the net somewhere but I cannot recall where it was.

thanks,

Hennie
 
The easiest way to to use an editor to create your source code, then compile from the command line. For example, I wrote
Code:
#include <iostreams.h>

int main()
{
        cout << &quot;Hello, World&quot; << endl;
        return 0;
}
and saved this as hi.cpp. At the command line I typed
Code:
bcc32 hi
and it compiled. Again at the command line, I then ran the program. Of cource, you can include your favorite or necessary compiler options on the command line, use the resource file, or a make file, too. James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.

[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
I think we are talking about different things.

I want to spawn a dos program from within my cbuilder application and capture the output from the dos program.

I tried to run the program like this:

program.exe >output.txt

in the cbuilder application I can open the file output.txt and show it in a control on a form.

BUT, when the program uses both stdout and stderr only half the output is shown on the form.

What I need is some code to avoid the step of redirecting output to an intermediate file.
 
Opps.[colorface] I don't know if this is what you are looking for or not:
James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.

[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top