1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 10:22:52 +01:00

Open binary files in binary mode

This commit is contained in:
haphzd 2016-06-08 22:37:00 +04:00
parent 95a7417c36
commit e82be612a1
4 changed files with 5 additions and 5 deletions

View File

@ -371,7 +371,7 @@ void GameData::loadGXT(const std::string &name)
void GameData::loadWaterpro(const std::string& path)
{
std::ifstream ifstr(path.c_str());
std::ifstream ifstr(path.c_str(), std::ios_base::binary);
if(ifstr.is_open()) {
uint32_t numlevels;

View File

@ -510,7 +510,7 @@ template<class T> bool readBlock(std::FILE* str, T& out) {
bool SaveGame::loadGame(GameState& state, const std::string& file)
{
std::FILE* loadFile = std::fopen(file.c_str(), "r");
std::FILE* loadFile = std::fopen(file.c_str(), "rb");
if (loadFile == nullptr) {
std::cerr << "Failed to open save file" << std::endl;
return false;
@ -1202,7 +1202,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
#include <dirent.h>
bool SaveGame::getSaveInfo(const std::string& file, BasicState *basicState)
{
std::FILE* loadFile = std::fopen(file.c_str(), "r");
std::FILE* loadFile = std::fopen(file.c_str(), "rb");
SaveGameInfo info;
info.savePath = file;

View File

@ -155,7 +155,7 @@ FileHandle FileIndex::openFile(const std::string& filename)
}
else
{
std::ifstream dfile(fsName.c_str());
std::ifstream dfile(fsName.c_str(), std::ios_base::binary);
if ( ! dfile.is_open()) {
throw std::runtime_error("Unable to open file: " + fsName);
}

View File

@ -106,7 +106,7 @@ void dumpOpcodes(SCMFile* scm, SCMOpcodes* codes, unsigned int offset, unsigned
void disassemble(const std::string& scmname)
{
std::ifstream scmfile(scmname.c_str());
std::ifstream scmfile(scmname.c_str(), std::ios_base::binary);
if( !scmfile.is_open() ) {
std::cerr << "Failed to open " << scmname << std::endl;