Many real-life problems handle large volumes of data, therefore we need to use some devices such as floppy disk or hard disk to store the data.
The data is stored in these devices using the concept of files. A file is a collection of related data stored in a particular area on the disk.
Programs can be designed to perform the read and write operations on these files.
A program typically involves either or both of the following kinds of data communication:
Data transfer between the console unit and the program.
Data transfer between the program and a disk file.
The input/output system of C++ handles file operations which are very much similar to the console input and output operations.
It uses file streams as an interface between the programs and the files.
The stream that supplies data to the program is known as input stream and the one that receives data from the program is known as output stream.
In other words, the input stream extracts or reads data from the file and the output stream inserts or writes data to the file.