Disable output buffering on stdout in c

By | March 28, 2013

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

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *