7.19.1 Introduction
The header <stdio.h> declares three types, several macros, and many functions for performing input and output.
The types declared are size_t (described in 7.17);
FILE
which is an object type capable of recording all the information needed to control a stream, including its file position indicator, a pointer to its associated buffer (if any), an error indicator that records whether a read/write error has occurred, and an end-of-file indicator that records whether the end of the file has been reached; and
fpos_t
which is an object type other than an array type capable of recording all the information needed to specify uniquely every position within a file.
The macros are NULL (described in 7.17);
_IOFBF
_IOLBF
_IONBF
which expand to integer constant expressions with distinct values, suitable for use as the third argument to the setvbuf function;
BUFSIZ
which expands to an integer constant expression that is the size of the buffer used by the setbuf function;
EOF
which expands to an integer constant expression, with type int and a negative value, that is returned by several functions to indicate end-of-file, that is, no more input from a stream;
FOPEN_MAX
which expands to an integer constant expression that is the minimum number of files that the implementation guarantees can be open simultaneously;
FILENAME_MAX
which expands to an integer constant expression that is the size needed for an array of char large enough to hold the longest file name string that the implementation guarantees can be opened;[1]
L_tmpnam
which expands to an integer constant expression that is the size needed for an array of char large enough to hold a temporary file name string generated by the tmpnam function;
SEEK_CUR
SEEK_END
SEEK_SET
which expand to integer constant expressions with distinct values, suitable for use as the third argument to the fseek function;
TMP_MAX
which expands to an integer constant expression that is the maximum number of unique file names that can be generated by the tmpnam function;
stderr
stdin
stdout
which are expressions of type “pointer to FILE” that point to the FILE objects associated, respectively, with the standard error, input, and output streams.
The header <wchar.h> declares a number of functions useful for wide character input and output. The wide character input/output functions described in that subclause provide operations analogous to most of those described here, except that the fundamental units internal to the program are wide characters. The external representation (in the file) is a sequence of “generalized” multibyte characters, as described further in 7.19.3.
The input/output functions are given the following collective terms:
The wide character input functions – those functions described in 7.24 that perform input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar, fwscanf, wscanf, vfwscanf, and vwscanf.
The wide character output functions – those functions described in 7.24 that perform output from wide characters and wide strings: fputwc, fputws, putwc, putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
The wide character input/output functions – the union of the ungetwc function, the wide character input functions, and the wide character output functions.
The byte input/output functions – those functions described in this subclause that perform input/output: fgetc, fgets, fprintf, fputc, fputs, fread, fscanf, fwrite, getc, getchar, gets, printf, putc, putchar, puts, scanf, ungetc, vfprintf, vfscanf, vprintf, and vscanf.
Forward References
Footnotes