Unbuffering pipes

WEAVERLING 00499 at vax1.acs.udel.edu
Mon Oct 16 14:10:00 AEST 1989


I am attempting to write my first UNIX C program and all went well except
for one glitch. I am using popen() on sar. The program uses sar to collect
usage statistics based on two params, first specifies the time period
and the second specifies how many samples to take. The program then 
dresses up the output from sar (using curses routines).
 
My problem is the pipe is buffered (BUFSIZ=1024 on my box), so I don't
get data through the pipe until a few time periods have passed (... when
the buffer fills).
 
I've tried using fflush() and setbuf(), but have had no success. I assume
that unbuffering must be possible, since sar invokes sadc, which outputs
binary data to stdout.
 
My box (a Prime EXL 325) runs Sys V 3.1
 
Any clues? Many thanks!
 
Ken Weaverling   +1 302 573 5460       | "OS/2 is like AIDS
Delaware Technical & Community College |  They say millions have it
00499 at vax1.acs.udel.edu                |  You don't know anyone that's got it
weave at pyr1.acs.udel.edu                |  And you pray to God you don't get it"



More information about the Comp.unix.questions mailing list