fix: open file as binary-mode #16

to avoid inconsistency between file size (obtained by tellg) and the
size of the actual contents that would be read later
This commit is contained in:
ToruNiina
2019-02-13 19:18:09 +09:00
parent 53f6b8268b
commit dd9319245e
3 changed files with 36 additions and 2 deletions

View File

@@ -1517,7 +1517,7 @@ inline table parse(std::istream& is, std::string fname = "unknown file")
inline table parse(const std::string& fname)
{
std::ifstream ifs(fname.c_str());
std::ifstream ifs(fname.c_str(), std::ios_base::binary);
if(!ifs.good())
{
throw std::runtime_error("toml::parse: file open error -> " + fname);