The GNU C++ Iostream Library - Stdiobuf

Node: Stdiobuf Next: Procbuf Prev: Formatting Up: Streambuf

Wrappers for C stdio

A stdiobuf is a streambuf object that points to a FILE object (as defined by stdio.h ). All streambuf operations on the stdiobuf are forwarded to the FILE . Thus the stdiobuf object provides a wrapper around a FILE , allowing use of streambuf operations on a FILE . This can be useful when mixing C code with C++ code.

The pre-defined streams cin , cout , and cerr are normally implemented as stdiobuf objects that point to respectively stdin , stdout , and stderr . This is convenient, but it does cost some extra overhead.

If you set things up to use the implementation of stdio provided with this library, then cin , cout , and cerr will be set up to to use stdiobuf objects, since you get their benefits for free. See C Input and Output.


Next: Procbuf Up: Streambuf