std::strstream::strstream (3) - Linux Manuals
std::strstream::strstream: std::strstream::strstream
NAME
std::strstream::strstream - std::strstream::strstream
Synopsis
strstream(); (1)
strstream(char* s, int n, std::ios_base::openmode mode (2)
= std::ios_base::in | std::ios_base::out);
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 member, which is initialized in one of the two possible ways, both of which use a 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 for output
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::ostrstream)