Closes the file currently associated with the object, disassociating them.
Any pending output sequence is written to the file (as if calling virtual member overflow), along with any unshift characters (codecvt::unshift), when needed.
The function fails if any of these operations fail, or if no file is currently open.
Parameters
none
Return Value
The function returns this, if successful.
In case of failure (including when the file is not open), a null pointer is returned.
Modifies the basic_filebuf object.
Concurrent access to the same file stream buffer object may introduce data races.
Exception safety
Basic guarantee: if an exception is thrown, the file stream buffer is in a valid state.
Any exception thrown by an internal operation is caught by the function and rethrown after closing the file.