Oracle® Solaris Studio 12.4: C++ User's Guide

Exit Print View

Updated: March 2015
 
 

13.10.1 streambuf Pointer Types

A streambuf consists of a stream or sequence of characters and one or two pointers into that sequence. Each pointer points between two characters. (Pointers cannot actually point between characters, but thinking of them that way can be helpful.) There are two kinds of streambuf pointers:

  • A put pointer, which points just before the position where the next character will be stored

  • A get pointer, which points just before the next character to be fetched

A streambuf can have one or both of these pointers.

The positions of the pointers and the contents of the sequences can be manipulated in various ways. Whether or not both pointers move when manipulated depends on the kind of streambuf used. Generally, with queue-like streambuf streams, the get and put pointers move independently. With file-like streambuf streams the get and put pointers always move together. A strstream is an example of a queue-like stream; an fstream is an example of a file-like stream.