cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : IOstream Library : ostringstream : rdbuf
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
IOstream Library
manipulators
classes:
· filebuf
· fstream
· ifstream
· ios
· iostream
· ios_base
· istream
· istringstream
· ofstream
· ostream
· ostringstream
· streambuf
· stringbuf
· stringstream
objects:
· cerr
· cin
· clog
· cout
types:
· fpos
· streamoff
· streampos
· streamsize
ostringstream
· ostringstream::ostrings...
member functions:
· ostringstream::rdbuf
· ostringstream::str

-

ostringstream::rdbuf public member function
stringbuf* rdbuf ( ) const;

Get/set the associated stringbuf object

Returns a pointer to the stringbuf object associated with the stream.

Parameters

none

Return Value

A pointer to the stringbuf object associated with the stream.
Notice that for any successfully constructed ostringstream object this pointer is never NULL, even if the buffer string is empty.

Example

// ostringstream::rdbuf
#include <iostream>
#include <sstream>
using namespace std;

int main () {
  stringbuf *pbuf;
  ostringstream oss;

  pbuf=oss.rdbuf();
  pbuf->sputn ("Sample string",13);
  cout << pbuf->str();

  return 0;
}

Basic template member declaration

( basic_ostringstream<charT,traits,Allocator> )
basic_stringbuf<charT,traits,Allocator> * rdbuf () const;

See also

ios::rdbuf Get/set the associated stream buffer (public member function)
stringbuf String stream buffer (class)

© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us