Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!sgi!shinobu!odin!sgihub!dragon!sam.wpd.sgi.com!pj From: pj@sam.wpd.sgi.com (Paul Jackson) Newsgroups: comp.sys.sgi Subject: Re: Pipes... Message-ID: <1991May12.010624.1808@dragon.wpd.sgi.com> Date: 12 May 91 01:06:24 GMT References: <4250.on.Fri,.10.May.91.20:53:34.EDT.@sct60a.sunyct.edu> Sender: news@dragon.wpd.sgi.com (CNews Account) Reply-To: pj@sgi.com Organization: Silicon Graphics, Research & Development Lines: 20 In article <4250.on.Fri,.10.May.91.20:53:34.EDT.@sct60a.sunyct.edu>, sweetmr@SCT60A.SUNYCT.EDU (michael sweet) writes: |> |> In a project I am working on, I want to fork and exec another process with |> pipes to *both* the standard input and output of the new process. Only call pipe once, not twice. The pipe(2) system call provides a pair of file descriptors, one good for reading and one for writing. And after duping them in the child to its stdin/stdout, close the file descriptors that you got from pipe. See an example, using the command "cat" instead of "tar" on page 130, Section 6.3, of Marc J. Rochind's "Advanced Unix Programming", Prentice Hall,1985. -- I won't rest till it's the best ... Software Production Engineer Paul Jackson (pj@wpd.sgi.com), x1373