save.c (455B)
1 #include "save.h" 2 3 #include <stdio.h> 4 5 b8 save(const Transform *t) 6 { 7 FILE *fp; 8 fp = fopen("savedata", "w"); 9 if (!fp) return false; 10 fwrite(t, 1, sizeof(Transform), fp); 11 fclose(fp); 12 return true; 13 } 14 15 b8 load(Transform *t) 16 { 17 FILE *fp; 18 fp = fopen("savedata", "r"); 19 if (!fp) return false; 20 fread(t, sizeof(Transform), 1, fp); 21 fclose(fp); 22 return true; 23 } 24