iostream hierarchy
filebuf:: close
  cplusplus.com  
filebuf * close ( );

Close file.
  Closes the file currently open. Any pending output sequence is written to the physical file.

Parameters.

none
 

Return Value.
  In case of success the function returns this, otherwise a null pointer.

Example.

// filebuf::close ()
#include <iostream>
#include <fstream>
using namespace std;

int main () {

  ifstream is;
  filebuf * fb;

  fb = is.rdbuf();
  fb->open ("test.txt",ios::in);

  // >> file buffer operations here <<

  fb->close();

  return 0;
}

Basic template member declaration ( basic_filebuf<charT,traits> ):
basic_filebuf* close ( );

See also.
  open, is_open
  filebuf class


© The C++ Resources Network, 2001