fix: build on Windows

This commit is contained in:
2024-01-19 15:56:45 +01:00
parent 0abe351697
commit 56044d8dc0
7 changed files with 84 additions and 19 deletions

View File

@@ -1,11 +1,21 @@
#include "../include/pasm.h"
#include "fmemopen.h"
#include <stdio.h>
int main(void) {
char output[1024] = {0};
FILE *memfile = fmemopen(output, sizeof(output), "w");
FILE *memfile = fmemopen(output, sizeof(output), "w+");
pasm_run_script("../examples/test.pasm", 0, 0, memfile);
fclose(memfile);
printf("%s", output);
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
printf("%s", output);
fclose(memfile);
} else {
printf("null\n");
}
return 0;
}