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
noneReturn Value
In case of success, the function returns this.In case of failure, a null pointer is returned.
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
filebuf::open | Open file (public member function) |
filebuf::is_open | Check if a file is open (public member function) |