Friday, April 24, 2009

Class for file stream operations

Class for file stream operations

The I/O system of C++ contains a set of classes that define the file handling methods. These include
ifstream
ofstream
fstream.

The above classes are derived from fstreambase and from the corresponding iostream.h.
Details of file stream classes are:
filebuf
fstreambase
ifstream
ofstream
fstream

filebuf
Its purpose is to set the file buffers to read and write. Contains openprot constant used in the open() of file stream classes. Also contains close() and open() as members.

fstreambase
Provides operations common to the file streams. Serves as a base for fstream, if stream and ofstream classes. Contains open() and close() function.

ifstream
Porvides input operations. Contains open() with default input mode. Inherits the functions
get()
getline()
read()
seekg() and
tellg() functions from istream.

ofstream
Provides output operations. Contains open() with default input mode. Inherits the functions
pet()
write()
seekp() and
tellp() function from ostream.

fstream
Provide support for simultaneous input and output operations. Contains open() with default input mode. Inherits all the functions from istream and ostream classes through iostream.

No comments:

Post a Comment