Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
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
filebuf
filebuf::filebuf
filebuf::~filebuf
member functions:
filebuf::close
filebuf::is_open
filebuf::open
virtual members:
filebuf::imbue
filebuf::overflow
filebuf::pbackfail
filebuf::seekoff
filebuf::seekpos
filebuf::setbuf
filebuf::showmanyc
filebuf::sync
filebuf::uflow
filebuf::underflow


filebuf

class
<fstream>

File stream buffer

Class hierarchy:
filebuf

This class applies the functionality of the streambuf class to read and write from/to files.

By calling member open, a physical file is associated to the file buffer as its associated character sequence. Depending on the mode used in this operation, the access to the controlled input sequence or the controlled output sequence may be restricted.

The state of the filebuf object -i.e. wether a file is open or not- may be tested by calling member function is_open.

Internally, filebuf objects operate as defined in the streambuf class (see streambuf), with the particularity that a joint position pointer is maintained for both the input and the output controlled sequences.

The class overrides some virtual members inherited from streambuf to provide a specific functionality for files.

Public members


Public members inherited from streambuf:

Virtual protected members


The parent class streambuf defines several protected virtual functions that are called by the other member functions to perform the operations on the associated character sequence. Derived classes override these virtual member functions as necessary to provide the functionality for their specific types of buffer. filebuf overrides the following:


The remaining virtual protectected members (xsgetn and xsputn) are left with their by-default behavior defined in streambuf.

Protected members

The class also inherits several non-virtual protected members used by the public functions to access the internal pointers. See streambuf for more info.