Chapter 16: The Standard I/O (stdio) Library

In chapter 12, we met several of the functions in C's Standard I/O library (often called stdio, sometimes pronounced ``studio'', named after the header file <stdio.h> which declares its routines). In this chapter, we'll describe most of the functions and other facilities available in <stdio.h>, and explain how they're useful.

(Note: this is an uncharacteristically long and complete chapter. It tries to describe just about all of the Standard I/O library, including features you aren't likely to be using for a while. Don't feel you have to understand every word in this chapter--when you get to an obscure part, just skim through it to get an idea of what's available, and come back and read it again as you have occasion to use the feature.)

16.1: Files and Streams

16.2: Opening and Closing Files (fopen, fclose, etc.)

16.3: Character Input and Output (getchar, putchar, etc.)

16.4: Line Input and Output (fgets, fputs, etc.)

16.5: Formatted Output (printf and friends)

16.6: Formatted Input (scanf)

16.7: Arbitrary Input and Output (fread, fwrite)

16.8: EOF and Errors

16.9: Random Access (fseek, ftell, etc.)

16.10: File Operations (remove, rename, etc.)

16.11: Redirection (freopen)

Read sequentially: prev next up top
