stdout
is line-buffered only if connected to a terminal. Eclipse's terminal-emulation might not be detected as terminal.
From man stdout
:
The stream stdout is line-buffered when it points to a terminal.
There are several way to get around this limitation:
- call
fflush(stdout)
every time output shall appear set
stdout
to be unbuffered by usingsetvbuf()
like thissetvbuf(stdout, NULL, _IONBF, 0);
prior to using
stdout
.- use
stderr
which isn't buffered by default