[NEW] feof(), freadw(), fwritew()

This commit is contained in:
2022-10-03 18:52:44 +02:00
parent aad3ba639a
commit c361eef2ff
3 changed files with 36 additions and 3 deletions

View File

@@ -928,24 +928,30 @@ void fclose() {
fclose(file);
}
bool feof() {
return feof(file);
}
void fwritei(int value) {
sprintf(fstr, "%i ", value);
fwrite(fstr, strlen(fstr), 1, file);
}
void fwrited(float value) {
char str[255];
sprintf(fstr, "%f ", value);
fwrite(fstr, strlen(fstr), 1, file);
}
void fwrites(const char *value) {
char str[255];
sprintf(fstr, "\"%s\" ", value);
fwrite(fstr, strlen(fstr), 1, file);
}
void fwritew(const char *value) {
sprintf(fstr, "%s ", value);
fwrite(fstr, strlen(fstr), 1, file);
}
void fwriteb(bool value) {
char str[255];
sprintf(fstr, value?"true ":"false ", value);
fwrite(fstr, strlen(fstr), 1, file);
}
@@ -971,6 +977,11 @@ const char *freads() {
return fstr;
}
const char *freadw() {
fscanf(file, "%s", &fstr);
return fstr;
}
bool freadb() {
fscanf(file, "%s", &fstr);
return strcmp(fstr, "true")==0?true:false;