The fstream.h header predefines a set or operations for handling files related to input and output. It defines certain classes that help to perform file input and output. For example, ifstream class links a file to the program for input and ofstream class links a file to the program for output and fstream classifies a file to the program for both input and output.
The file operations make use of streams as an interface between the programs and the files, A stream is a sequence of bytes and general name given to flow of data. Input stream and output stream represent different kind of data flow into the memory or out of the memory. The C++ provides ofstream class to write on files, ifstream class to read from files and fstream class to both read and write from/to file.
These classes are derived from fstreambase and from those declared in the header file ” iostream.h”. The classes ofstream, ifstream, and fstream are designed exclusively to manage the disk files and their declaration are present in the header file “fstream.h”. To make use of these classes, fstream.h is included in all the programs which handle disk files.