08-17-04 12:59 PM
In article <4121de0e$1_1@news.iprimus.com.au>, "New" <a@a.co> wrote:
> How can I uses a pipe to get the output from a execv() and redirect it to
a
> parent process?
> in ansi c if possible
Create the pipe in the parent process, then fork. In the child, use
dup2() to put the writing end of the pipe on stdout, then close the
pipe's descriptors. In the parent, close the writing end of the pipe
and read from the reading end.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
[ Post a follow-up to this message ]
|