<quote who="John Clarke">

> On Mon, Mar 24, 2003 at 05:08:08PM +1100, James Gregory wrote:
> > On Mon, 2003-03-24 at 17:08, Amanda Wynne wrote:
> > > I mean I only get output to the screen about every 20th call to printf.
> > 
> > stdout is line buffered by default IIRC. You probably want to switch
> > your pty to "hot" mode or something - I don't recall the details, but
> > search for "stdout buffer mode" - you should find something useful.
> 
> See setbuf(3):

<SNIP>

> To make stdout unbuffered, call setbuf(stdout, _IONBF);

Or, alternatively, call fflush to flush the buffers after you've printed
something useful.

printf("\r10% Complete");
fflush(stdout);
printf("\r20% Complete");
fflush(stdout);
-- 
Jan Schmidt                                  [EMAIL PROTECTED]

<stibbons> Yeah.  The whole climax thing would make much more sense
           if I'd paid attention.
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to