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
1 changed files with 3 additions and 3 deletions

View File

@ -60,12 +60,12 @@ bool IOFile::Open(const std::string& filename, const char openmode[])
{
Close();
#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
m_file = fopen(filename.c_str(), openmode);
m_file = std::fopen(filename.c_str(), openmode);
m_good = m_file != nullptr;
#endif
m_good = IsOpen();
return m_good;
}