std::ostrstream::ostrstream (3) - Linux Manuals
std::ostrstream::ostrstream: std::ostrstream::ostrstream
NAME
std::ostrstream::ostrstream - std::ostrstream::ostrstream
Synopsis
ostrstream(); (1)
ostrstream(char* s, int n, std::ios_base::openmode mode = std::ios_base::out); (2)
Constructs new 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 member, which is initialized in one of the two possible ways, both of which write to user-provided fixed-size array:
a) if the app bit is not set in mode, constructs the buffer by calling strstreambuf(s, n, s). The behavior is undefined if there are less than n elements in the array whose first element is pointed to by s
b) if the app bit is set in mode, constructs the buffer by calling strstreambuf(s, n, s + std::strlen(s)). The behavior is undefined if there are less than n elements in the array whose first element is pointed to by s or if the array does not contain a valid null-terminated character sequence.
Parameters
s - char array to use as the output buffer
n - size of the array to be used as the output buffer
mode - binary open in binary_mode
Example
// Run this code
Output:
See also
constructor (public member function of std::strstreambuf)
constructor (public member function of std::istrstream)
constructor (public member function of std::strstream)