Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!rbj From: rbj@uunet.UU.NET (Root Boy Jim) Newsgroups: comp.unix.programmer Subject: Re: How do I keep a pipe from buffering I/O? Keywords: pipe() exec() Message-ID: <124714@uunet.UU.NET> Date: 4 Mar 91 22:31:50 GMT References: <1585@gufalet.let.rug.nl> Organization: UUNET Communications Services, Falls Church, VA Lines: 19 In article <1585@gufalet.let.rug.nl> bert@let.rug.nl (Bert Bos) writes: >Problem is, the pipes appear to buffer such large amounts of text, >that one process only gets input after the other has already finished. >How do I force the pipes to pass on text one line at a time? I don't think that pipes are any different than plain files as far as buffering is concerned. If there is data available to read, it should be made available, byte by byte. >I'm using calls such as pipe(), dup2(), select(), read(), etc, but I >couldn't find anything in the manuals. Ah, but what are you using to write? Printf uses stdio, and will most likely be buffered. Use sprintf followed by write, or fflush to force data thru the pipe. -- [rbj@uunet 1] stty sane unknown mode: sane