Professional Documents
Culture Documents
L10-Files - & - String Input PDF
L10-Files - & - String Input PDF
This statement opens the file info.txt in input modes. Input mode allows data
to be read from a file
This statement opens the file info.txt in both input and output modes.
File Access (fstream)
Example
Example
Assuming that diskInfo is an fstream object, write a statement that opens the file
names.dat for output.
Write a statement that defines an fstream object named dataFile and opens a file named
salesfigures.txt for input. (Note: The file should be opened with the definition statement,
not an open function call.)
Functions and File Parameters
File stream objects may be passed to functions, but they should always be passed by
reference.