fix(core): reopen file on load/save
This commit is contained in:
parent
3bca700ab6
commit
7261f88dbd
@ -33,6 +33,7 @@ int sappyou_free(Sappyou *sappyou) {
|
||||
}
|
||||
|
||||
int sappyou_load(Sappyou *sappyou) {
|
||||
sappyou->file = freopen(NULL, "rb", sappyou->file);
|
||||
if (sappyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -66,6 +67,7 @@ int sappyou_load(Sappyou *sappyou) {
|
||||
}
|
||||
|
||||
int sappyou_save(Sappyou *sappyou) {
|
||||
sappyou->file = freopen(NULL, "wb", sappyou->file);
|
||||
if (sappyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -94,7 +96,7 @@ int sappyou_save(Sappyou *sappyou) {
|
||||
}
|
||||
|
||||
int sappyou_open(Sappyou *sappyou, const char *path) {
|
||||
sappyou->file = fopen(path, "r+b");
|
||||
sappyou->file = fopen(path, "rb");
|
||||
if (sappyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -102,7 +104,7 @@ int sappyou_open(Sappyou *sappyou, const char *path) {
|
||||
}
|
||||
|
||||
int sappyou_dump(Sappyou *sappyou, const char *path) {
|
||||
sappyou->file = fopen(path, "w+b");
|
||||
sappyou->file = fopen(path, "wb");
|
||||
if (sappyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ int sasahyou_free(Sasahyou *sasahyou) {
|
||||
}
|
||||
|
||||
int sasahyou_load(Sasahyou *sasahyou) {
|
||||
sasahyou->file = freopen(NULL, "rb", sasahyou->file);
|
||||
if (sasahyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -65,6 +66,7 @@ int sasahyou_load(Sasahyou *sasahyou) {
|
||||
}
|
||||
|
||||
int sasahyou_save(Sasahyou *sasahyou) {
|
||||
sasahyou->file = freopen(NULL, "wb", sasahyou->file);
|
||||
if (sasahyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -90,7 +92,7 @@ int sasahyou_save(Sasahyou *sasahyou) {
|
||||
}
|
||||
|
||||
int sasahyou_open(Sasahyou *sasahyou, const char *path) {
|
||||
sasahyou->file = fopen(path, "r+b");
|
||||
sasahyou->file = fopen(path, "rb");
|
||||
if (sasahyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -98,7 +100,7 @@ int sasahyou_open(Sasahyou *sasahyou, const char *path) {
|
||||
}
|
||||
|
||||
int sasahyou_dump(Sasahyou *sasahyou, const char *path) {
|
||||
sasahyou->file = fopen(path, "w+b");
|
||||
sasahyou->file = fopen(path, "wb");
|
||||
if (sasahyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ int shoppyou_free(Shoppyou *shoppyou) {
|
||||
}
|
||||
|
||||
int shoppyou_load(Shoppyou *shoppyou) {
|
||||
shoppyou->file = freopen(NULL, "rb", shoppyou->file);
|
||||
if (shoppyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -54,6 +55,7 @@ int shoppyou_load(Shoppyou *shoppyou) {
|
||||
}
|
||||
|
||||
int shoppyou_save(Shoppyou *shoppyou) {
|
||||
shoppyou->file = freopen(NULL, "wb", shoppyou->file);
|
||||
if (shoppyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -76,7 +78,7 @@ int shoppyou_save(Shoppyou *shoppyou) {
|
||||
}
|
||||
|
||||
int shoppyou_open(Shoppyou *shoppyou, const char *path) {
|
||||
shoppyou->file = fopen(path, "r+b");
|
||||
shoppyou->file = fopen(path, "rb");
|
||||
if (shoppyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
@ -85,7 +87,7 @@ int shoppyou_open(Shoppyou *shoppyou, const char *path) {
|
||||
}
|
||||
|
||||
int shoppyou_dump(Shoppyou *shoppyou, const char *path) {
|
||||
shoppyou->file = fopen(path, "w+b");
|
||||
shoppyou->file = fopen(path, "wb");
|
||||
if (shoppyou->file == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user