[prev] [index] [next]

Buffering and fflush

The stdio.h library buffers input/output
  • when you do e.g. putc, char is not sent to stream
  • rather it is placed in a buffer in memory
  • when this buffer fills up, entire contents sent to stream
  • also, all buffers are flushed when program finishes
int fflush(FILE *outf);
  • allows programmer to control flushing of output buffers
  • forces contents of buffer for outf to output