The ____________ fstream member function closes a file stream. Explain why it is best to close a file when the program is through processing the data in the file.

a) close( )
b) overloaded operator <<( )
c) open( )
d) eof( )
e) flush( )

a) close( )

Part a) close() 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) opens a file stream and connects it to a physical file. The argument is a C-string constant or variable. 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.) Part e) flush( ) is used without argument to write the file buffer out to the physical medium.

Computer Science & Information Technology

You might also like to view...

When two or more procedures in an application may need to use the same variable or array, you can declare the memory locations in the form's ____ section.

A. Memory B. Storage C. Declarations D. Statements

Computer Science & Information Technology

What is the NFS server configuration file that lists directories to be made available to NFS clients? Provide an example of an entry in this file and explain what it does.

What will be an ideal response?

Computer Science & Information Technology