How do I keep a pipe from buffering I/O?

Root Boy Jim rbj at uunet.UU.NET
Tue Mar 5 08:31:50 AEST 1991


In article <1585 at gufalet.let.rug.nl> bert at 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 at uunet 1] stty sane
		unknown mode: sane



More information about the Comp.unix.programmer mailing list