Date: Wed, 17 Jun 1998 17:02:11 +0300 (IDT) From: Eli Zaretskii To: Brett Porter 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: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.