Compartilhar via


basic_ostringstream::str

Sets or gets the text in a string buffer without changing the write position.

basic_string<Elem, Tr, Alloc> str( ) const;
void str(
    const basic_string<Elem, Tr, Alloc>& _Newstr
);

Parameters

  • _Newstr
    The new string.

Return Value

Returns an object of class basic_string<Elem, Tr, Alloc>, whose controlled sequence is a copy of the sequence controlled by *this.

Remarks

The first member function returns rdbuf -> str. The second member function calls rdbuf -> str(_Newstr).

Example

See basic_stringbuf::str for an example that uses str.

Requirements

Header: <sstream>

Namespace: std

See Also

Reference

basic_ostringstream Class

iostream Programming

iostreams Conventions

Other Resources

basic_ostringstream Members