1/10
Vocabulary flashcards for file I/O in C++.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
ofstream
Stream class to write to files. Requires the fstream library.
ifstream
Stream class to read from files. Requires the fstream library.
fstream
A class within the fstream library that can both read and write to files. It has no default mode, so it is better to use ifstream or ofstream instead.
open(filename, mode)
A stream object member function used to open a file with a specified filename and mode.
Mode (file I/O)
Specifies how a file should be opened (e.g., read, write, append). Modes can be combined using the | operator.
ios::app
File mode that appends new data to the end of an existing file.
ios::trunc
File mode that truncates the file, deleting the old content when opening.
myfile.fail()
A method to check if opening a file has failed.
myfile.close()
A method to close the connection to a file.
getline(stream, variable)
A function that reads a line from a stream (e.g., a file) until a delimiter (newline character) is encountered, and stores it in a variable.
Quoted Text
Can read strings with quotes from a text file.