From 75cc757fa5d89f915bbc263917cd51cbfb624c52 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Fri, 19 Jan 2024 16:07:35 +0100 Subject: [PATCH] fix: memfile reading on linux vs windows --- tests/lib_use.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/lib_use.c b/tests/lib_use.c index f7ec09b..64aaef9 100644 --- a/tests/lib_use.c +++ b/tests/lib_use.c @@ -5,15 +5,18 @@ int main(void) { char output[1024] = {0}; FILE *memfile = fmemopen(output, sizeof(output), "w+"); - + if (memfile != NULL) { pasm_run_script("../examples/test.pasm", 0, 0, memfile); #ifdef _WIN32 - fseek(memfile, 0, SEEK_SET); - fread(output, sizeof(char), sizeof(output), memfile); -#endif + fseek(memfile, 0, SEEK_SET); + fread(output, sizeof(char), sizeof(output), memfile); printf("%s", output); fclose(memfile); +#else + fclose(memfile); + printf("%s", output); +#endif } else { printf("null\n"); }