basic_istringstream::rdbuf

To retrieve a pointer to the stream buffer.

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

Remarks

To manipulate a stream for random access or synchronization it is necessary to retrieve a pointer to the streams buffer. The function rdbuf() allows you to retrieve this pointer.

A pointer to an object of type basic_stringbuf sb is returned by the rdbuf function.

See Also

basic_ostringstream::rdbuf()

basic_ios::rdbuf()

basic_stringstream::rdbuf()

Listing: Example of basic_istringstream::rdbuf() usage.
#include <iostream>
#include <sstream>

std::string buf = "CodeWarrior - \"Software at work\"";
char words[50];

int main()
{
using namespace std;
   istringstream ist(buf); 
   istream in(ist.rdbuf());
   in.seekg(25);
   in.get(words,50);
   cout << words;
   return 0
}

Result

  "Software at work"