From a6b99078decf1312040accaef88eaf8920743ace Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Tue, 31 Aug 2021 19:30:46 +0100 Subject: [PATCH] Changed file_talk files to open in binary mode --- src/uxncli.c | 2 +- src/uxnemu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uxncli.c b/src/uxncli.c index 3a00a88..453a48a 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -81,7 +81,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w) Uint16 result = 0, length = peek16(d->dat, 0xa); long offset = (peek16(d->dat, 0x4) << 16) + peek16(d->dat, 0x6); Uint16 addr = peek16(d->dat, b0 - 1); - FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w")); + FILE *f = fopen(name, read ? "rb" : (offset ? "ab" : "wb")); if(f) { fprintf(stderr, "%s %s %s #%04x, ", read ? "Loading" : "Saving", name, read ? "to" : "from", addr); if(fseek(f, offset, SEEK_SET) != -1) diff --git a/src/uxnemu.c b/src/uxnemu.c index 1aa87b9..d1703cf 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -346,7 +346,7 @@ file_talk(Device *d, Uint8 b0, Uint8 w) Uint16 result = 0, length = peek16(d->dat, 0xa); long offset = (peek16(d->dat, 0x4) << 16) + peek16(d->dat, 0x6); Uint16 addr = peek16(d->dat, b0 - 1); - FILE *f = fopen(name, read ? "r" : (offset ? "a" : "w")); + FILE *f = fopen(name, read ? "rb" : (offset ? "ab" : "wb")); if(f) { fprintf(stderr, "%s %s %s #%04x, ", read ? "Loading" : "Saving", name, read ? "to" : "from", addr); if(fseek(f, offset, SEEK_SET) != -1)