#include <iostream.h>
All the iostream classes in the ios hierarchy depend on an attached streambuf class for the actual I/O processing. This class is an abstract class, but the iostream class library contains the following derived buffer classes for use with streams:
All streambuf objects, when configured for buffered processing, maintain a fixed memory buffer, called a reserve area, that can be dynamically partitioned into a get area for input, and a put area for output. These areas may or may not overlap. With the protected member functions, you can access and manipulate a get pointer for character retrieval and a put pointer for character storage. The exact behavior of the buffers and pointers depends on the implementation of the derived class.
The capabilities of the iostream classes can be extended significantly through the derivation of new streambuf classes. The ios class tree supplies the programming interface and all formatting features, but the streambuf class does the real work. The ios classes call the streambuf public members, including a set of virtual functions.
The streambuf class provides a default implementation of certain virtual member functions. The “Default Implementation” section for each such function suggests function behavior for the derived class.
Character Input Functions — Public Members
Returns the number of characters in the get area.
Returns the character at the get pointer, but does not move the pointer.
Advances the get pointer, then returns the next character.
Returns the current character, and then advances the get pointer.
Moves the get pointer forward one position, but does not return a character.
Attempts to move the get pointer back one position.
Gets a sequence of characters from the streambuf object’s buffer.
Character Output Functions — Public Members
Returns the number of characters in the put area.
Stores a character in the put area and advances the put pointer.
Stores a sequence of characters in the streambuf object’s buffer and advances the put pointer.
Construction/Destruction — Public Members
Virtual destructor.
Diagnostic Functions — Public Members
Prints buffer statistics and pointer values.
Virtual Functions — Public Members
Empties the get area and the put area.
Attempts to attach a reserve area to the streambuf object.
Seeks to a specified offset.
Seeks to a specified position.
Empties the put area.
Fills the get area if necessary.
Augments the sputbackc function.
Construction/Destruction — Protected Members
Constructors for use in derived classes.
Other Protected Member Functions — Protected Members
Returns a pointer to the start of the reserve area.
Returns a pointer to the end of the reserve area.
Returns the size of the reserve area.
Returns a pointer to the start of the put area.
Returns the put pointer.
Returns a pointer to the end of the put area.
Returns the lower bound of the get area.
Returns the get pointer.
Returns a pointer to the end of the get area.
Sets all the put area pointers.
Sets all the get area pointers.
Increments the put pointer.
Increments the get pointer.
Sets up the reserve area.
Tests or sets the streambuf buffer state variable.
Allocates a buffer, if needed, by calling doalloc.
Allocates a reserve area (virtual function).
See Also streambuf::doallocate, streambuf::unbuffered