Question Detail

Which among following is correct syntax of closing a file in c++ ?

  • myfile$close();
  • myfile@close();
  • myfile:close();
  • myfile.close();
Similar Questions :

1. How to find the position at end of fileObject ?

  • fileObject.seekg( 0, ios::end );
  • fileObject.seekg( 0, ios::end );
  • fileObject.seekg( 0, ios::end );
  • fileObject.seekg( 0, ios::end );

2. Which stream class is to only write on files ?

  • ofstream
  • ifstream
  • fstream
  • iostream

3. Which stream class is to only read from files ?

  • ofstream
  • ifstream
  • fstream
  • iostream

4. How to get position to the nth byte of fileObject ?

  • fileObject.seekg( 'filename',n );
  • fileObject.seekg( n, 'filename' );
  • fileObject.seekg( n );
  • fileObject.seekg( n, ios::app );

5. Which among following is correct syntax of closing a file in c++ ?

  • myfile$close();
  • myfile@close();
  • myfile:close();
  • myfile.close();
Read more from - C++ File Handling Questions Answers