Mail Archives: djgpp/1998/04/30/22:26:24
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 -