Next: Low-Level I/O, Previous: I/O Overview, Up: Top

## 12 Input/Output on Streams

This chapter describes the functions for creating streams and performing input and output operations on them. As discussed in I/O Overview, a stream is a fairly abstract, high-level concept representing a communications channel to a file, device, or process.

- Streams: About the data type representing a stream.
- Standard Streams: Streams to the standard input and output devices are created for you.
- Opening Streams: How to create a stream to talk to a file.
- Closing Streams: Close a stream when you are finished with it.
- Streams and Threads: Issues with streams in threaded programs.
- Streams and I18N: Streams in internationalized applications.
- Simple Output: Unformatted output by characters and lines.
- Character Input: Unformatted input by characters and words.
- Line Input: Reading a line or a record from a stream.
- Unreading: Peeking ahead/pushing back input just read.
- Block Input/Output: Input and output operations on blocks of data.
- Formatted Output: `printf` and related functions.
- Customizing Printf: You can define new conversion specifiers for `printf` and friends.
- Formatted Input: `scanf` and related functions.
- EOF and Errors: How you can tell if an I/O error happens.
- Error Recovery: What you can do about errors.
- Binary Streams: Some systems distinguish between text files and binary files.
- File Positioning: About random-access streams.
- Portable Positioning: Random access on peculiar ISO C systems.
- Stream Buffering: How to control buffering of streams.
- Other Kinds of Streams: Streams that do not necessarily correspond to an open file.
- Formatted Messages: Print strictly formatted messages.