Sometimes it’s useful to disable buffering for printf/fprintf etc. This is especially the case when you’re trying to debug a program and you’re not sure if it’s going to exit prematurely, before the output buffer gets flushed.
It’s a pain to stick fflush() after every fprintf. The proper way to do it is:
The manpage assures us this is equivalent to the more verbose
setvbuf(stream, NULL, _IONBF, BUFSIZ);