Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
IOstream Library
manipulators
classes:
filebuf
fstream
ifstream
ios
iostream
ios_base
istream
istringstream
ofstream
ostream
ostringstream
streambuf
stringbuf
stringstream
objects:
cerr
cin
clog
cout
types:
fpos
streamoff
streampos
streamsize
filebuf
filebuf::filebuf
filebuf::~filebuf
member functions:
filebuf::close
filebuf::is_open
filebuf::open
virtual members:
filebuf::imbue
filebuf::overflow
filebuf::pbackfail
filebuf::seekoff
filebuf::seekpos
filebuf::setbuf
filebuf::showmanyc
filebuf::sync
filebuf::uflow
filebuf::underflow


filebuf::close

public member function
filebuf * close ( );

Close file

Closes the file currently associated with the object and disassociates it.

Any pending output sequence is written to the physical file. This is done by calling virtual member overflow.

The function fails if no file is currently open (associated) with this object.

Parameters

none

Return Value

In case of success, the function returns this.
In case of failure, a null pointer is returned.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 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