fstream::close
void close ( );
fstream
  cplusplus.com  

Close an open file.
  Closes a file. The stream's file buffer is released from its association with the currently open file.

Parameters.

none
 

Return Value.
  none

Example.

// opening and closing a file
#include <iostream>
#include <fstream>
using namespace std;

int main () {

  fstream filestr;

  filestr.open ("test.txt");

  // >> i/o operations here <<

  filestr.close();
  return 0;
}
This example simply opens and closes a file.

Basic template member declaration ( basic_fstream<charT,traits> ):
void close ( );

See also.
  open
  fstream class


© The C++ Resources Network, 2001