It returns a pointer to the internal filebuf object.
DeclarationFollowing is the declaration for fstream::rduf.
C++11filebuf* rdbuf() const;Return Value
It returns a pointer to the internal filebuf object.
ExceptionsStrong guarantee − if an exception is thrown, there are no changes in the stream buffer.
Data racesIt accesses the stream object.
It concurrent access to the same stream object may cause data races.
In below example explains about fstream rdbuf function.
#include <fstream> #include <cstdio> int main () { std::fstream src,dest; src.open ("test.txt"); dest.open ("copy.txt"); std::filebuf* inbuf = src.rdbuf(); std::filebuf* outbuf = dest.rdbuf(); char c = inbuf->sbumpc(); while (c != EOF) { outbuf->sputc (c); c = inbuf->sbumpc(); } dest.close(); src.close(); return 0; }
fstream.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4