UI: Use binary mode for QuickReadFile
When not using binary mode (i.e. text mode) CRLF will be converted to LF, which means that the size provided by tellg() is no longer correct, and reading prematurely hits an EOF and sets the fail bit.
This commit is contained in:
parent
5dd1d00a03
commit
c55fcbbb12
1 changed files with 1 additions and 1 deletions
|
|
@ -68,7 +68,7 @@ try {
|
|||
|
||||
static bool QuickReadFile(const char *file, std::string &data)
|
||||
try {
|
||||
std::ifstream fileStream(file);
|
||||
std::ifstream fileStream(file, std::ifstream::binary);
|
||||
if (!fileStream.is_open() || fileStream.fail())
|
||||
throw strprintf("Failed to open file '%s': %s", file,
|
||||
strerror(errno));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue