Chapter 7 - Input and Output
Input and output are not part of the C language itself, so we have not emphasized them in our presentation thus far. Nonetheless, programs interact with their environment in much more complicated ways than those we have shown before. In this chapter we will describe the standard library, a set of functions that provide input and output, string handling, storage management, mathematical routines, and a variety of other services for C programs. We will concentrate on input and output
The ANSI standard defines these library functions precisely, so that they can exist in compatible form on any system where C exists. Programs that confine their system interactions to facilities provided by the standard library can be moved from one system to another without change.
The properties of library functions are specified in more than a dozen headers; we have already seen several of these, including <stdio.h>
, <string.h>
, and <ctype.h>
. We will not present the entire library here, since we are more interested in writing C programs that use it. The library is described in detail in Appendix B.