Merge pull request #5632 from sepalani/file

File/IOFile: Check _tfopen_s properly
This commit is contained in:
shuffle2 2017-06-17 15:03:10 -07:00 committed by GitHub
commit e9c0535519

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;
} }