Monday, July 27, 2009

What is Buffered and Unbuffered files.How is it used in files in C programming.?

A buffered file in C is one where writes are buffered (placed in memory) and only written when explicitly flushed or when a file is closed (fclose). An unbuffered file writes directly to disk (or to a device) without buffering to memory. Buffered files are usually faster, but you risk data loss if there is a power fail or system reset. Unbuffered files guarantee data but are much slower.





See: stdio, fopen, fclose, fflush in C

silk flowers

1 comment:

  1. definition is ok but may i know the examples of buffered and unbuffered files please...

    ReplyDelete