⧼⧼  Previous Page
⧼  Table of Contents  ⧽
Next Page  ⧽⧽

Reading and Writing to Text Files

Computer Programming C++ / File I/O

Writing to, and reading from, files is a common task for software developers. The following videos will show you how.

Before reading in from a file, you'll need to know about the getline() function.

Now, let's read the file!

Review Questions

The following are examples of questions similar to what you can expect to see on the next exam.

Hover over a question to show the answer.
  1. How would you open a file called "data.txt" for reading (using "ifs" as the file stream variable)? ifs.open("data.txt");
  2. How would you close it? ifs.close();

Above and Beyond

The content past here is related, but beyond the scope of the class. In other words, you will not be tested on this!

Generalizing an Output Function

Sometimes you want to output files to multiple places, this video will show you a little trick to doing so.

⧼⧼  Previous Page
⧼  Table of Contents  ⧽
Next Page  ⧽⧽
© Ryan Appel