diff options
| author | stijn | 2017-08-14 12:01:38 +0200 |
|---|---|---|
| committer | Damien George | 2019-09-18 22:15:48 +1000 |
| commit | bc86c6252ab1b9a9ee47a44d7ccc9e1a9d74f207 (patch) | |
| tree | 8fb9f6b9041b807be384d7bae7ee9368a572c433 /ports/windows | |
| parent | 22131a673856a5c9f5a50bda0bf6fb0a69c706b6 (diff) | |
windows: Default to binary mode for files.
If this is not set it might default to calls to open() to use text mode
which is usually not wanted, and even wrong and leading to incorrect
results when loading binary .mpy files.
This also means that text files written and read will not have line-ending
translation from \n to \r\n and vice-versa anymore. This shouldn't be much
of a problem though since most tools dealing with text files adapt
automatically to any of the 2 formats.
Diffstat (limited to 'ports/windows')
| -rw-r--r-- | ports/windows/Makefile | 1 | ||||
| -rw-r--r-- | ports/windows/init.c | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/ports/windows/Makefile b/ports/windows/Makefile index e65c09c53..af815383c 100644 --- a/ports/windows/Makefile +++ b/ports/windows/Makefile @@ -40,6 +40,7 @@ SRC_C = \ realpath.c \ init.c \ sleep.c \ + fmode.c \ $(SRC_MOD) OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) diff --git a/ports/windows/init.c b/ports/windows/init.c index 09fa10417..73ab71375 100644 --- a/ports/windows/init.c +++ b/ports/windows/init.c @@ -31,6 +31,7 @@ #include <crtdbg.h> #endif #include "sleep.h" +#include "fmode.h" extern BOOL WINAPI console_sighandler(DWORD evt); @@ -61,6 +62,7 @@ void init() { // https://msdn.microsoft.com/en-us/library/bb531344(v=vs.140).aspx _set_output_format(_TWO_DIGIT_EXPONENT); #endif + set_fmode_binary(); } void deinit() { |
