std::basic_ostringstream::basic_ostringstream

From Cppreference

Jump to: navigation, search
basic_ostringstream( ios_base::openmode mode =
(1)
basic_ostringstream( const std::basic_string<CharT,Traits,Allocator>& str,                                  
                     ios_base::openmode mode =
(2) (C++11 feature)
basic_ostringstream( basic_ostringstream&& other );
(3) (C++11 feature)

Constructs new string stream.

1) Constructs new underlying string device. The underlying basic_stringbuf object is constructed as

2) Uses a copy of str as initial contents of the underlying string device. The underlying basic_stringbuf object is constructed as

3) Move constructor. Constructs the file stream with the state of other using move semantics.

[edit] Parameters

str - string to use as initial contents of the string stream
mode - specifies stream open mode. It is bitmask type, the following constants are defined:
Constant Explanation
app seek to the end of stream before each write
binary open in binary mode
in open for reading
out open for writing
trunc discard the contents of the stream when opening
ate seek to the end of stream immediately after open
other - another string stream to use as source

[edit] Example

[edit] See also

str
gets or sets the contents of underlying string device object
(public member function)