What are disk file with stream ?

Disk File I/O with streams:

Most of the programs need to save data on disk file I/O. Working with disk file I/O requires another set of classes:  Such as ifstream class for user input, fstream class for using both input and output, and ofstream for output. Objects of these classes can be associated with disk files, and they can use their member functions to read and write to the files.

In C++ programming ifstream class is derived from istream class, fstream class is derived from iostream class, and ofstream class is derived from ostream class.

The file-oriented classes are also derived, by multiple inheritance, from the fstream base class. This class contains an object of class filebuf, which is a file-oriented buffer, and its associated member functions, derived from the more general streambuf class.

In formatted I/O, numbers are stored on the disk as a series of characters. It can read the file generated using an ifstream object. The file is automatically opened when the object is created. It can then read from it using the extraction (>>) operator.

Post a Comment

Thankyou

Previous Post Next Post