11.3. System File I/O
System file I/O involves the use of systems calls and some library routines for reading and writing files and doing control functions such as file locking or altering file flags. These I/O interfaces do not abstract the target of the I/O as a file stream, nor do they provide the extra level of buffering as the standard I/O (stdio) interfaces. From a layering perspective, the stdio interfaces sit above the file I/O system calls. The fopen(3S) library interface ultimately calls the open(2) system call, fread(3S) calls read(2), fwrite(3S) calls write(2), and so on.
11.3.1. File I/O System Calls
Once a file descriptor is established, a number of system calls can operate on the open file descriptor. The most basic system calls ...