Unix Programming - execv()

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > August 2004 > execv()





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author execv()
New

2004-08-17, 7:59 am

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

Thank-you


Barry Margolin

2004-08-17, 7:59 am

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 ***
Chuck Dillon

2004-08-17, 7:59 am

New 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
>
> Thank-you
>
>


Give http://www.faqs.org/faqs/unix-faq/programmer/faq/ a read.

-- ced

--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com