use binary mode for win files

pull/112/head
Dave Vasilevsky 6 months ago
parent cb961a54b0
commit 446087ed7a

@ -69,7 +69,7 @@ AC_FUNC_MALLOC
AC_FUNC_REALLOC AC_FUNC_REALLOC
AC_FUNC_STRTOD AC_FUNC_STRTOD
AC_CHECK_FUNCS([memchr memmove memset strerror strtol sched_getaffinity sysconf AC_CHECK_FUNCS([memchr memmove memset strerror strtol sched_getaffinity sysconf
GetSystemInfo]) GetSystemInfo _setmode])
AC_CHECK_HEADER([sys/endian.h], AC_CHECK_HEADER([sys/endian.h],
[ [
AC_CHECK_DECLS([htole64, le64toh], [], [], [ AC_CHECK_DECLS([htole64, le64toh], [], [], [

@ -164,6 +164,12 @@ int main(int argc, char **argv) {
} }
} }
#ifdef HAVE__SETMODE
// Set files to binary encoding
_setmode(_fileno(gInFile), O_BINARY);
_setmode(_fileno(gOutFile), O_BINARY);
#endif
switch (op) { switch (op) {
case OP_WRITE: case OP_WRITE:
if (isatty(fileno(gOutFile)) == 1) if (isatty(fileno(gOutFile)) == 1)

Loading…
Cancel
Save