KRHS Internet Lesson

Teacher Name:Mr. Rung                          Date of Lesson: January

Course Name: C++                    Lesson Name: Chap 11.2b

Student Name

Password


Objective
To complete the workbook exercises.


Primary Focus
Match the following to the appropriate choice.

Site Links
Course Home Page

Additional Resources

Site Links


What three steps must be performed when working with a sequential-access file?
A ifstream
What must you do if you need to work with more than one file at a time?
B outfile.open("DATAOUT.DAT", ios::out);
When declaring a file pointer for an output file, of what type must the file pointer be?
C outfile « "Emily Sirns\n"; outfile.close();
When declaring a file pointer for an input file, of what type must the file pointer be?
D rawdata.open("RAWDATA.DAT", ios::in);
Write a statement that declares a file pointer named outfile for writing to a file.
E declare a file pointer, open the file, and close the file.
Write a statement that opens a file named DATAOUT.DAT for output using the file pointer named outfile.
F ifstream rawdata;
Write a statement that writes your name to the data file pointed to by outfile, followed by a statement that closes the file.
G declare more than one file pointer
Write a statement that declares a file pointer named rawdata for reading from a file.
H ofstream outfile;
Write a statement that opens a file named RAWDATA.DAT for input using the file pointer named rawdata.
I rawdata.get(input-string, 80); rawdata.ignore (80, '\n'); rawdata.close();
Write a statement that reads a line from the file named RAWDATA.DAT into a character array named input-string, followed by a statement that closes the file.
J ofstream