ofstream::close
void close ( );
ofstream
  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 () {

  ofstream outfile;

  outfile.open ("test.txt");

  // >> i/o operations here <<

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

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

See also.
  open
  ofstream class


© The C++ Resources Network, 2001