When can i expect "stdout" printed to console

view story

http://stackoverflow.com – I know this is because of buffering of stdout but when can i expect output of stdout in the following proggram. If i run, I am always getting "stderr" as output. If i add '\n' or fflush(stdout) then only i am getting both statements. If i don't add '\n' or fflush(stdout),i am not getting "stdout" as output. when will i get all buffered "stdout"s as output if i don't add '\n' or fflush(stdout). #include <stdio.h> #include <unistd.h> int main() { for(;;) { fprintf(stdout,"stdout"); fprintf(stderr,"stderr"); sleep(1); } (HowTos)