Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uwm.edu!bionet!agate!ucbvax!tut.cis.ohio-state.edu!uoft02.utoledo.edu!desire.wright.edu!wright!news From: sdawalt@valhalla.wright.edu (Shane Dawalt) Newsgroups: comp.os.msdos.programmer Subject: Re: Spawning processes in DOS Message-ID: <1991Apr5.015914.23557@cs.wright.edu> Date: 5 Apr 91 01:59:14 GMT Article-I.D.: cs.1991Apr5.015914.23557 References: <1991Apr3.133226.22304@ibmpa.awdpa.ibm.com> Sender: news@cs.wright.edu (USENET News System) Reply-To: sdawalt@valhalla.wright.edu Organization: Wright State University Lines: 28 From article <1991Apr3.133226.22304@ibmpa.awdpa.ibm.com>, by dougs@claude1.rchland.ibm.com (J Doug Smith): > > ____ > > I'm trying to write an application that will run another program and get > that program's output so it can be displayed to the user (much like an > editor runs a compiler and sends the compiler's output to the user). Does > anyone have any Ideas on how to accomplish this? Execing another programs > certainly is no problem, I just don't see how to get the output from that > program. One idea springs to mind. Of course, it requires that the exec'd program BIOS calls to write to the screen (none of this direct write stuff). It is known that a child inherits, at the very least, the parent's file handles. (If you tell the EXEC function, the child will also inherit the parent's environment.) If you redirect stderr and/or stdout of the parent then spawn the child, the child's stderr/stdout will also be redirected. You can redirect these output streams to a temporary file. After exec terminates, clean up the parents output streams by "un-"redirecting them then process the temporary file as you wish. Shane(); -------------------------------------------------------------------------- From the keyboard of: email: sdawalt@cs.wright.edu Shane A. Dawalt --------------------------------------------------------------------------