| fstream::rdbuf filebuf* rdbuf ( ) const; | fstream | 
| cplusplus.com | 
 Get the filebuf object associated with the stream.
 
Returns the filebuf object associated with the stream.
Parameters.
 Return Value.
 
A pointer to the filebuf object associated with the stream.
 
Notice that this pointer is never NULL, even if the buffer is not associated with any file.
It is a pointer to the private filebuf object.
 Example.
// open and close a file using buffer members
#include <fstream>
using namespace std;
int main () {
  char ch;
  fstream filestr;
  filebuf *pbuf;
  pbuf=filestr.rdbuf();
  
  pbuf->open ("test.txt", fstream::in | fstream::out);
  // >> i/o operations here <<
  pbuf->close();
  return 0;
}
Basic template member declaration ( basic_fstream<charT,traits> ):
| basic_filebuf<charT,traits> * rdbuf () const; | 
 See also.
 
ios::rdbuf
 
filebuf class,
fstream class