in reply to Re: can you autoflush a program in unix?
in thread can you autoflush a program in unix?
However, most applications will autoflush STDOUT when it's connected to a tty.GNU libc by default opens stdout in line buffered mode if it's tty, and stderr is opened in unbuffered mode. The following code will demonstrate behavior:
On my Ubuntu it outputs "This is stderror output" and 5 seconds later "This is stdio output"#include <stdio.h> #include <unistd.h> main() { printf("This is stdio output"); fprintf(stderr, "This is stderror output"); sleep(5); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: can you autoflush a program in unix?
by ikegami (Patriarch) on Oct 20, 2009 at 19:33 UTC |