1 2 3 4 5 6 7 8 9 10 11 12

Input/Output Streams

#include <fstream.h>

If you want to open a file

ifstream StreamName (file_specification);
ifstream InputData ("test.data");

For an output file:

ofstream StreamName (file_specification);
ofstream OutputData ("test.results");

To receive data you now simply replace cinby InputData To output results, simply replace coutby OutputData

Once you have finished with input and output streams then close them with:

StreamName.close ();

24-Mar-98

Page 5

TAM/C201