On Thu, Apr 04, 2002, Omer Musaev wrote about "RE: c question":
> Instead of using buffered output and flushing it on every char, 
> you can use raw output.
>..
> ---------------------------------------------------
>        write(1, "#", 1 ) ; /* man write(2) */
>        sleep( 1 ) ;

This is getting into deep C territory, but...
You don't have to switch to system calls and lose the convenience of printf
in order not to have your output buffered. You have two other alternatives:

1. fprintf into stderr instead of stdout. stderr by default is not
   buffered.

2. Use setvbuf (see setbuf(3)) to make stdout unbuffered.
   By default, stdout is line-buffered if the standard output is a terminal
   (see isatty(3)) and block-buffered otherwise.

-- 
Nadav Har'El                        |      Thursday, Apr 4 2002, 22 Nisan 5762
[EMAIL PROTECTED]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |In Fortran, God is real unless declared
http://nadav.harel.org.il           |an integer.

=================================================================
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]

Reply via email to