Additionally, in case that the second constructor version is used, the stream's buffer is initialized with the content of the string object str as if a call to member str.
Parameters
- which
- Bitmask with the requested i/o mode for the string buffer. This is an object of type ios_base::openmode. It generally consists of a combination of one or more the following flags (which are member constants):
flag value opening mode app (append) Set the stream's position indicator to the end of the stream before each output operation. ate (at end) Set the stream's position indicator to the end of the stream on opening. binary (binary) Consider stream as binary rather than text. in (input) Allow input operations on the stream. out (output) Allow output operations on the stream. trunc (truncate) Any current content is discarded, assuming a length of zero on opening. - str
- string object to be copied as the initial value for the internal buffer string.
Return Value
noneExample
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
This example uses the constructor to declare a stringstream for both input and output operations. A string is inserted into the stringstream and then it is extracted as integer values.
Basic template member declaration
( basic_stringstream<charT,traits,Allocator> )| 1 2 3 |
|
See also
| stringstream::str | Get/set the associated string object (public member function) |
