File/IOFile: Check _tfopen_s properly

This commit is contained in:
Sepalani 2017-06-17 02:16:58 +01:00
parent 10beb2aea1
commit b359d82890

View File

@ -60,12 +60,12 @@ bool IOFile::Open(const std::string& filename, const char openmode[])
{ {
Close(); Close();
#ifdef _WIN32 #ifdef _WIN32
_tfopen_s(&m_file, UTF8ToTStr(filename).c_str(), UTF8ToTStr(openmode).c_str()); m_good = _tfopen_s(&m_file, UTF8ToTStr(filename).c_str(), UTF8ToTStr(openmode).c_str()) == 0;
#else #else
m_file = fopen(filename.c_str(), openmode); m_file = std::fopen(filename.c_str(), openmode);
m_good = m_file != nullptr;
#endif #endif
m_good = IsOpen();
return m_good; return m_good;
} }