Share via


strstreambuf Class

Describes a stream buffer that controls the transmission of elements to and from a sequence of elements stored in a char array object.

class strstreambuf : public streambuf

Remarks

Depending on how the object is constructed, it can be allocated, extended, and freed as necessary to accommodate changes in the sequence.

An object of class strstreambuf stores several bits of mode information as its strstreambuf mode. These bits indicate whether the controlled sequence:

  • Has been allocated and needs to be freed eventually.

  • Is modifiable.

  • Is extendable by reallocating storage.

  • Has been frozen and hence needs to be unfrozen before the object is destroyed, or freed (if allocated) by an agency other than the object.

A controlled sequence that is frozen cannot be modified or extended, regardless of the state of these separate mode bits.

The object also stores pointers to two functions that control strstreambuf allocation. If these are null pointers, the object devises its own method of allocating and freeing storage for the controlled sequence.

Note

This class is deprecated. Consider using stringbuf or wstringbuf instead.

Constructors

strstreambuf

Constructs an object of type strstreambuf.

Member Functions

freeze

Causes a stream buffer to be unavailable through stream buffer operations.

overflow

A protected virtual function that can be called when a new character is inserted into a full buffer.

pbackfail

A protected virtual member function that tries to put back an element into the input stream, and then make it the current element (pointed to by the next pointer).

pcount

Returns a count of the number of elements written to the controlled sequence.

seekoff

A protected virtual member function that tries to alter the current positions for the controlled streams.

seekpos

A protected virtual member function that tries to alter the current positions for the controlled streams.

str

Calls freeze, and then returns a pointer to the beginning of the controlled sequence.

underflow

A protected virtual function to extract the current element from the input stream.

Requirements

Header: <strstream>

Namespace: std

See Also

Reference

streambuf

Thread Safety in the C++ Standard Library

iostream Programming

iostreams Conventions