编辑 维基 ^ |< << 幻灯片93/221 >> >| |
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
输入/输出功能并不是C语言本身的组成部分,所以到目前为止,我们并没有过多地强调它们。但是,程序与环境之间的交互比我们在前面部分中描述的情况要复杂很多。本章将讲述标准库,介绍一些输入/输出函数、字符串处理函数、存储管理函数与数学函数,以及其他一些C语言程序的功能。本章讨论的重点将放在输入/输出上。
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.
ANSI标准精确地定义了这些库函数,所以,在任何可以使用C语言的系统中都有这些函数的兼容形式。如果程序的系统交互部分仅仅使用了标准库提供的功能,则可以不经修改地从一个系统移植到另一个系统中。
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.
这些库函数的属性分别在十多个头文件中声明,前面已经遇到过一部分,如<stdio.h>、<string.h>和<ctype.h>。我们不打算把整个标准库都罗列于此,因为我们更关心如何使用标准库编写C语言程序。附录B对标准库进行了详细的描述。