std::strstreambuf::overflow

protected: virtual int_type overflow (int_type c = EOF); Appends the character c to the put area of the buffer, reallocating if possible. 1) If c==EOF, does nothing 2) Otherwise, if the put area has a write position available (pptr() < epptr()), stores the character as if by *pptr()++ = c 3) Otherwise, if the stream buffer mode is not dynamic or the stream buffer is currently frozen, the function fails and returns EOF 4) Otherwise, the function reallocates (or initially allocat

std::strstreambuf

Defined in header <strstream> class strstreambuf : public std::basic_streambuf<char> (deprecated) std::strstreambuf is a std::basic_streambuf whose associated character sequence is a character array, which may be constant (e.g. a string literal), modifyable but not dynamic (e.g. a stack-allocated array), or dynamic, in which case the std::strstreambuf may be allowed to reallocate the array as necessary to accomodate output (e.g. by calling delete[] and new[] or user-p

std::strstreambuf::freeze

void freeze( bool freezefl = true ); If the buffer uses dynamic allocation, sets the frozen status of the stream to freezefl. While the stream is frozen, overflow() will not reallocate the buffer and the destructor will not deallocate the buffer (thereby causing a memory leak). Parameters freezefl - new value to set the freeze status to Return value (none). Notes Every call to str() freezes the stream to preserve the validity of the pointer it returns. To allow the dest

std::strstream::strstream

strstream(); (1) strstream(char* s, int n, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out); (2) Constructs new input/output strstream and its underlying std::strstreambuf. 1) Default-constructs the underlying std::strstreambuf, which creates a dynamically growing buffer, and initializes the base class with the address of the strstreambuf member. 2) Initialized the base class with the address of the underlying std::strstreambuf me

std::strstream::pcount

int pcount() const; Returns the number of characters that were output in the put area of the associated std::strstreambuf. Effectively calls rdbuf()->pcount(). Parameters (none). Return value The number of characters in the put area, or zero if nothing was output. Example #include <strstream> #include <iostream> int main() { std::strstream dyn; // dynamically-allocated output buffer dyn << "Test: " << 1.23; std::cout << "The size

std::strstream::str

char* str(); Returns the pointer to the beginning of the buffer, after freezing it. Effectively calls rdbuf()->str(). Notes After a call to str(), dynamic streams become frozen. A call to freeze(false) is required before exiting the scope in which this strstream object was created. otherwise the destructor will leak memory. Also, additional output to a frozen stream may be truncated once it reaches the end of the allocated buffer. Parameters (none). Return value Pointer to th

std::strstream::freeze

void freeze(bool flag = true); If the stream is using a dynamically-allocated array for output, disables (flag == true) or enables (flag == false) automatic allocation/deallocation of the buffer. Effectively calls rdbuf()->freeze(flag). Notes After a call to str(), dynamic streams become frozen automatically. A call to freeze(false) is required before exiting the scope in which this strstream object was created. otherwise the destructor will leak memory. Also, additional output to

std::strstream

Defined in header <strstream> class strstream : public std::iostream (deprecated) The class strstream implements input and output operations on array-backed streams. It essentially wraps a raw array I/O device implementation (std::strstreambuf) into the higher-level interface of std::basic_iostream. The typical implementation of strstream holds only one non-derived data member: an object of type std::strstreambuf. Notes After any call to str(), a call to freeze(false) is

std::strstream::rdbuf

strstreambuf* rdbuf() const; Returns a pointer to the associated std::strstreambuf, casting away its constness (despite the const qualifier on the member function). Parameters (none). Return value Pointer to the associated std::strsteambuf, with constness cast away. Example #include <strstream> int main() { const std::strstream buf; std::strstreambuf* ptr = buf.rdbuf(); }

std::strspn

Defined in header <cstring> size_t strspn( const char* dest, const char* src ); Returns the length of the maximum initial segment (span) of the byte string pointed to by dest, that consists of only the characters found in byte string pointed to by src. Parameters dest - pointer to the null-terminated byte string to be analyzed src - pointer to the null-terminated byte string that contains the characters to search for Return value The length of the maximu