The GNU C++ Iostream Library - 6. C Input and Output

Go to the first, previous, next, last section, table of contents.

# 6. C Input and Output

`libio` is distributed with a complete implementation of the ANSI C `stdio` facility. It is implemented using `streambuf` objects. See section 5.4 Wrappers for C `stdio`.

The `stdio` package is intended as a replacement for the whatever `stdio` is in your C library. Since `stdio` works best when you build `libc` to contain it, and that may be inconvenient, it is not installed by default.

Extensions beyond ANSI:

- A stdio `FILE` is identical to a streambuf. Hence there is no need to worry about synchronizing C and C++ input/output--they are by definition always synchronized.
- If you create a new streambuf sub-class (in C++), you can use it as a `FILE` from C. Thus the system is extensible using the standard `streambuf` protocol.
- You can arbitrarily mix reading and writing, without having to seek in between.
- Unbounded `ungetc()` buffer.

Go to the first, previous, next, last section, table of contents.