The member function closes the stream but does not destroy it.
void close();
Use the function close() to close a stream. It may be re-opened at a later time using the member function open(). If failure occurs open() calls setstate(failbit) which may throw an exception.
There is no return value.
For an example, see Example of basic_fstream:: basic_fstream() usage.