00499@vax1.acs.udel.edu (WEAVERLING) (10/16/89)
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@vax1.acs.udel.edu | You don't know anyone that's got it weave@pyr1.acs.udel.edu | And you pray to God you don't get it"
davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (10/17/89)
Try using a pty of your system has them. -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon
news@uswat.UUCP (news) (10/18/89)
call.). This way you will not block on i/o ( until you buffer of 1024 gets full.) Your read will return with whatever is available at the other end. Happy programming. From: jpsingh@boulder.USWest.COM ( J. P. Singh #350 x6550 ) Path: boulder!jpsingh JPSingh