std::strstreambuf::str (3) - Linux Man Pages
std::strstreambuf::str - std::strstreambuf::str
char* str() const;
Calls freeze(), then returns a copy of start pointer of the get area, std::streambuf::eback().
The start of the get area, for all writeable std::strstreambuf objects constructed through the interface provided by std::strstream, is also the start of the put area.
A copy of eback(), which may be a null pointer.
This function is typically called through the std::strstream interface.
The call to freeze() guarantees that the returned pointer remains valid until the next explicit call to freeze(false): otherwise (on a dynamic buffer) any output operation could trigger buffer reallocation which would invalidate the pointer. It also causes a memory leak in the destructor of std::strstreambuf, unless freeze(false) is called before the buffer (or, more commonly, the std::strstream that manages it) is destroyed.
// Run this code
str (public member function of std::strstream)
str (public member function of std::ostrstream)
str (public member function of std::istrstream)