www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/13/10:22:30

Date: Thu, 13 Feb 1997 17:07:36 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: DNewton417 AT aol DOT com
cc: djgpp AT delorie DOT com
Subject: Re: How redirect dos output to graphics mode
In-Reply-To: <970211180548_1828212606@emout03.mail.aol.com>
Message-ID: <Pine.SUN.3.91.970213170107.10131C-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019