Buffering

  • When you direct data into a file, it is not sent there immediately.

    • It is physically written to the device only when the buffer is full.

  • When you read data from a file, you input it from the input buffer.

    • When the buffer becomes empty it is refilled with a new block of data.

  • Why buffer?

    • It reduces the number of accesses to the external device.

  • Only cerr, standard error, is never buffered .

    • Errors are critical.