Output to files

New IO streams can be declared, using the type fstream. A stream is associated with an external file when it is opened. Its access mode is set in the same function call.

If a file is not opened for a stream, the nil pointer is returned.

fstream O_file;
fstream I_file;

O_file.open("info.dat", ios::out);

I_file.open("results.dat",ios::in);


Next note in series

Back to index