Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!stanford.edu!agate!ucbvax!ucdavis!csusac!usenet From: emmonsl@athena.ecs.csus.edu (L. Scott Emmons) Newsgroups: comp.unix.programmer Subject: Re: how to use pipes (was: Re: system() question) Message-ID: <1991Mar7.180531.7907@csusac.csus.edu> Date: 7 Mar 91 18:05:31 GMT References: <1991Mar3.175234.11716@csusac.csus.edu> <1991Mar3.214844.15444@csusac.csus.edu> <5866:Mar604:22:3791@kramden.acf.nyu.edu> Sender: usenet@csusac.csus.edu (News account (alt)) Organization: California State University, Sacramento Lines: 22 In article <5866:Mar604:22:3791@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >This is, of course, because you aren't waiting for the child to finish. Actually, it does finish...the child closes the pipeline down when it is done. The read() reads unless eof, which it only returns when the write end of the pipeline is closed (it blocks if the pipeline is open with no data in it). I just did it all implicitly...If anyone can come up with an example where this wouldn't work please let me know. (except the obvious, where the child doesn't close the pipe, of course...but then, you are changing the environment of the usage, of course) Remember also, that I ignored all the return codes for simplicity in the examples. Check out my second version, it works the same, but is easier to see how I implemented this. L. Scott Emmons --------------- emmons@csus.csus.edu ...[ucbvax]!ucdavis!csus!emmons Packet: kc6nfp@kg6xx.#nocal.ca.usa.na