This chapter describes functions for performing low-level input/output
operations on file descriptors. These functions include the primitives
for the higher-level I/O functions described in I/O on Streams, as
well as functions for performing low-level control operations for which
there are no equivalents on streams.
Stream-level I/O is more flexible and usually more convenient;
therefore, programmers generally use the descriptor-level functions only
when necessary. These are some of the usual reasons:
For reading binary files in large chunks.
For reading an entire file into core before parsing it.
To perform operations other than data transfer, which can only be done
with a descriptor. (You can use fileno to get the descriptor
corresponding to a stream.)
To pass descriptors to a child process. (The child can create its own
stream to use a descriptor that it inherits, but cannot inherit a stream
directly.)