www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/17/10:02:26

Date: Wed, 17 Jun 1998 17:02:11 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Brett Porter <blp01 AT uow DOT edu DOT au>
cc: djgpp AT delorie DOT com
Subject: Re: Redirecting output
In-Reply-To: <3.0.5.32.19980617223636.007b7d20@pop.uow.edu.au>
Message-ID: <Pine.SUN.3.91.980617165722.20468G-100000@is>
MIME-Version: 1.0

On Wed, 17 Jun 1998, Brett Porter wrote:

> 	I'm working on a text based project here which uses text windows on
> occasion and shells to other programs.
> 	I was wondering if it is possible to redirect the output of this program
> into the window. The window will probably use the "conio.h" functions to
> define it, but called programs will ignore this using stdout. Even if the
> programs use cprintf, it won't know the calling programs settings will it?

The usual way to achieve this is to invoke the child programs via the 
`popen' library function, then read from the FILE * stream it returns.  
This way you get stdout of the child program redirected to you, but it 
means that the output won't be seen by the user until the child program 
returns and you display the redirected output in your window.  From your 
description, it is not clear whether this is a problem in your case.

There is no way to redirect output of conio functions, as it goes 
directly to the video RAM.  Direct console I/O is actually a memory move, 
so another program cannot intercept it.

- Raw text -


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