Miscellaneous
fopen/fread/fwrite/fclose, etc. are implemented in terms of low-level non-standard i/o functions open/read/write/close, etc.
There are 3 types of buffering:
- fully buffered (or block buffered):
- actual physical i/o takes place only when buffer is filled
- line buffered:
- actual i/o takes place when a newline (\n) is encountered
- unbuffered:
- output as soon as possible
All files are normally block buffered, except stdout (line buffered only if it refers to a terminal), and stderr (always unbuffered)
Can use fflush() to force a buffer to be cleared