Mail Archives: djgpp/1997/02/13/10:22:30
On Tue, 11 Feb 1997 DNewton417 AT aol DOT com wrote:
> I am writing a gui and need to redirect the output of a dos program to
> graphics mode in realtime.
> I have never programed graphics before
> so I could use all the help I could get.
It is not clear from your message whether the problem that bugs is how to
catch the output of a DOS program in your GUI, or how to display that
output in graphics mode after it had been captured (or both).
The easiest way to catch the output is by using the `popen' and `pclose'
library functions (look them up in the library reference). These emulate
a pipe between your program and the program you spawn; you get a FILE *
pointer which you can use to read from the pipe or write to the pipe.
This method only catches stdout of the child program; if you need to
catch stderr, you will have to redirect it yourself using `dup' and
`dup2' library functions (which see).
The way to display the output you catch depends on your GUI and graphics
library you use. You probably have some function which will take a
character string and print it at certain location on screen; just use
that function.
- Raw text -