diff options
Diffstat (limited to 'common/alfstream.cpp')
-rw-r--r-- | common/alfstream.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/common/alfstream.cpp b/common/alfstream.cpp index 7378c678..3beda833 100644 --- a/common/alfstream.cpp +++ b/common/alfstream.cpp @@ -88,11 +88,7 @@ auto filebuf::seekpos(pos_type pos, std::ios_base::openmode mode) -> pos_type } filebuf::~filebuf() -{ - if(mFile != INVALID_HANDLE_VALUE) - CloseHandle(mFile); - mFile = INVALID_HANDLE_VALUE; -} +{ close(); } bool filebuf::open(const wchar_t *filename, std::ios_base::openmode mode) { @@ -115,6 +111,13 @@ bool filebuf::open(const char *filename, std::ios_base::openmode mode) return open(wname.c_str(), mode); } +void filebuf::close() +{ + if(mFile != INVALID_HANDLE_VALUE) + CloseHandle(mFile); + mFile = INVALID_HANDLE_VALUE; +} + ifstream::ifstream(const wchar_t *filename, std::ios_base::openmode mode) : std::istream{nullptr} |