From 3fa74d5844e441f0cccf711791066efaab054b63 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 19 Jan 2025 20:42:57 +0500 Subject: feat: save/load .xd files (wip) --- src/xd.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/xd.c') diff --git a/src/xd.c b/src/xd.c index 5e9644e..32cc83e 100644 --- a/src/xd.c +++ b/src/xd.c @@ -4,15 +4,12 @@ #include #include -XdData *Xd_LoadFromFile(const char *filePath) { +XdData Xd_LoadFromFile(const char *filePath) { FILE *file = fopen(filePath, "rb"); - if (file == NULL) { - return NULL; - } - - XdData *data = malloc(sizeof(XdData)); - fread(data, sizeof(XdData), 1, file); + XdData data; + fread(&data, sizeof(XdData), 1, file); + printf("1 %s\n", data.name); fclose(file); return data; -- cgit v1.2.3