Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What class is used in C++ to write data to files?
Looks like output file stream.
Which method would you use to read an entire line from a file?
It helps to read line by line.
What is the purpose of the 'ofstream' class?
Think about what 'out' stands for.
True or False: It is necessary to close a file after opening it in C++.
Remember what happens if you don't close it.
Write a program that creates a file, writes some lines of text to it, and then reads those lines back to display on the console.
Look carefully at how you're writing and then reading the data.
Explain what happens if you read from a file that doesn't exist. Write a code snippet to handle this error.
Think about checking if the file is open before trying to read.
5 more questions in this section. Enroll free to practise them all.
Enroll free