unzip.cpp: Fix wrong open mode
By default, std::ofstream objects are opened under the std::ios::out mode, equivalent to "r" mode in fopen(3), which has non-portable behaviour. [1] In order to avoid non-portable behaviour, std::ios::binary must be used instead, equivalent to "rb" mode in fopen(3). [1]: https://en.cppreference.com/w/cpp/io/basic_ofstream/basic_ofstream
This commit is contained in:
parent
53a758688e
commit
1a4dc5f50f
1 changed files with 1 additions and 1 deletions
|
@ -65,7 +65,7 @@ end:
|
||||||
|
|
||||||
int unzip::extract(const std::string &path) const
|
int unzip::extract(const std::string &path) const
|
||||||
{
|
{
|
||||||
std::ofstream out(path);
|
std::ofstream out(path, std::ios::binary);
|
||||||
int ret = -1, error = unzOpenCurrentFile(f);
|
int ret = -1, error = unzOpenCurrentFile(f);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
|
|
Loading…
Reference in a new issue