File Processing Flashcards
Files are used for data persistence which is…
Permanent retention of data
How do computers store files?
Secondary storage devices
What is a file?
A sequence of bytes
Files end with
End-of-file marker
Or
Specific byte number recorded in data structure
What happens when a file is opened?
An object is created with associated stream
Which headers must be included for file processing?
<iostream> and <fstream>
</fstream></iostream>
<fstream>'s typedef aliases enables....
</fstream>
char output to files
C++ structure on file
Not imposed
When an ____________ object is created, a file can be opened for output
ofstream
What happens to existing files opened with iOS::out?
They are truncated
How can you add to the end of a file?
ios::app
ofstream objects must be created while opening a file
No, it can be attached later
What does overloaded operator ! do for a stream?
Determines if it is opened correctly
What is the failbit for cin?
End-of-file indicator
How can you close a stream object?
Use close member function or stream object’s destructor
Why do files store data?
So it can be received for processing when needed
When are objects of ifstream opened for input?
By default
How do you retrieve data sequentially from a file?
Read from the beginning until desired data is found
What is the file position pointer for ifstream?
seekg
What is the file position pointer for ostream?
seekp
How can you indicate the byte number in a file where next input will occur?
get pointer for istream
put pointer for ostream
Which three seek directions can seekg indicate?
ios::beg
ios::cur
ios::end
File position pointer specifies the location as number of bytes from file’s start location or it’s….
offset
What member functions return the current locations of the get and put pointers?
tellg and tellp