Disable output buffering on stdout in c

Like other languages output buffering takes place even in C. Output buffering will cause output of a program to appear in chunks after long intervals, instead of each line appearing the moment it is output. To disable output buffering a very strange piece of code has to be written which looks like this

//disable output buffering
setvbuf(stdout, NULL, _IONBF, 0);


Or call the fflush after every output


The above is for Linux.

Last Updated On : 28th March 2013

Subscribe to get updates delivered to your inbox

About Silver Moon

Php developer, blogger and Linux enthusiast. He can be reached at [email protected]. Or find him on

Leave a comment