To determine whether a file was opened successfully, one can use the ___________ fstream member function
a. close( )
b. overloaded operator <<( )
c. open( )
d. eof( )
e. flush( )
e)
Explanation: e) fail( ) returns a bool value of true if the file is in a failed state, and false if the file state can provide i/o. Part a) is used without argument to close the file to prevent file corruption, a possibility if the program terminates abnormally. Part b) has nothing to do with opening a file. Part c) is used with a C-string file name (either literal or C-string variable) to open the file and connect the stream to the file name. Part d) returns a type bool value of true if the file pointer has attempted to read at end of file. (To read beyond end of file is an error.)
You might also like to view...
The Bullets button is found on the ________ tab
Fill in the blank(s) with correct word
The ________ tab is wider than the Slides tab in order to provide additional space to type text
Fill in the blank(s) with correct word