Section

std::ostrstream

The class ostrstream implements 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_ostream.

# Declarations

class ostrstream : public std::ostream

(deprecated in C++98) (removed in C++26)

# Notes

After any call to str(), a call to freeze(false) is required to allow the destructor to deallocate the buffer as necessary.

Before any call to str() that uses the result as a C-string, the buffer must be null-terminated, typically with std::ends.

ostrstream has been deprecated since C++98 and removed since C++26. std::ostringstream, std::ospanstream(since C++23), and boost::iostreams::array_sink are the recommended replacements.