Next: Review Questions
Up: Streams and External Files
Previous: Testing for end-of-file
cin
and
cout
are used then the file fstream.h
must be included
in the program.ifstream
and output streams as having type ofstream
.open(
filename)
member function of the stream.
Failure of the
open(
filename)
function is tested by the
fail()
member function of the stream. End of file condition is
tested by the eof()
member function of the stream. A stream
(and the associated file) is closed by using the close()
member function of the stream.