> -----Original Message-----
> From: Sagi Bashari [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 04, 2002 12:39 PM
> To: Erez Doron; ilug
> Subject: Re: c question
>
>
> From: "Erez Doron" <[EMAIL PROTECTED]>
> > the problem is that printf does not sync it's buffers until
> a newline
> > so no progress bar is displayed until the job ends.
> >
> >
> > how do i solve this ?
>
> Try
> fflush(stdout);
>
> Sagi
Instead of using buffered output and flushing it on every char,
you can use raw output.
---------------------------------------------------
/* style comments go to /dev/null */
#include <stdio.h>
#include <time.h>
#include <unistd.h>
int
main( int argc, char* argv[] )
{
int i, count = 10 ;
printf( "Using buffered output\n" ) ;
for ( i = 0 ; i < count ; ++i )
{
printf("#") ;
sleep( 1 ) ;
}
printf( "\n" ) ;
printf( "Using raw output\n" ) ;
for ( i = 0 ; i < count ; ++i )
{
write(1, "#", 1 ) ; /* man write(2) */
sleep( 1 ) ;
}
printf( "\n" ) ;
return 0 ;
}
-------------------------------------------------
>
>
> =================================================================
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]
>
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]