| stringstream::str string str ( ) const; void str ( string & s ); | stringstream | 
| cplusplus.com | 
 Get/set the associated string object.
 
The first syntax returns a copy of the string object currently associated with the
internal buffer.
 
The second syntax sets a new value for the string object associated with
the buffer.
 
The buffer of a stringstream is usually associated with an STL
string object.
Parameters.
 Return Value.
 
The second syntax returns a copy of the string object
currently associated with the stream's buffer.
 Example.
// stringstream::str
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main () {
  stringstream oss;
  string mystr;
  oss << "Sample string";
  mystr=oss.str();
  cout << mystr;
  return 0;
}
Basic template member declaration ( basic_stringstream<charT,traits,Allocator> ):
| basic_string<charT,traits,Allocator> str () const; void str (const basic_string<charT,traits,Allocator> & s ); | 
 See also.
 
(constructor)
 
stringstream class