next up previous
Next: Streams Up: Introduction to C++ Programming Previous: Exercises


Streams and External Files

So far all input and output has been done by obtaining data from the input stream cin and sending output to the output stream cout. These streams have been connected to the keyboard and screen respectively. There are many situations when these facilities are not sufficient. For example:

  1. When the amount of data to be entered to a program is very large or when a program is to be executed at a later date with the same data. This may happen while developing and testing a program with a set of test data.
  2. When the data for a program has been produced by another computer program.
  3. When a permanent record of the output of a program is required.

In all these cases External Files are required. Thus if a program requires a significant amount of data to be entered then the data can be entered on a file using a text editor and this file used as the input medium while developing and testing the program. Similarly output can be sent to a file so that a permanent record of results is obtained.



Subsections
next up previous
Next: Streams Up: Introduction to C++ Programming Previous: Exercises
Peter JB King
1999-08-31