cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/30/22:26:24

Mime-Version: 1.0
To: "Andrew Crabtree" <andrewc AT rosemail DOT rose DOT hp DOT com>, djgpp AT delorie DOT com
From: Nate Eldredge <nate AT cartsys DOT com>
Subject: Re: RFI - Fork/Pipe pseudo code needed
Date: Thu, 30 Apr 1998 16:46:46 -0700
Message-ID: <19980430234635.AAF20209@ppp119.cartsys.com>

At 02:56  4/29/1998 -0700, Andrew Crabtree wrote:
>Could somebody please give me some pointers or pseudo code to do the
>following.
>
>1) Suspend the current program and execute another one (they are both djgpp
>programs if it makes a difference)
>2) Capture stdout from the child program to a temporary file
>3) Read in the temporary file from the parent after the child program has
>finished.
>
>I'm only familiar with the unix way of forking and piping, and am not quite
>sure which functions (spawn?) I should be looking at and how to do the
>redirection.  Presumably just close and dup2 or something but I'm not quite
>sure.

The `popen'/`pclose' scheme will do it all for you, if you don't mind
working at the ANSI streams level. If you want to do it yourself, you could
just look at the source for them.

Nate Eldredge
nate AT cartsys DOT com



- Raw text -


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