1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-09-20 04:24:48 +00:00

Make _WRITEFILE a statement

- rather than a function as suggested by @a740g
This commit is contained in:
Roland Heyder 2024-02-16 20:26:55 +01:00
parent f51da87249
commit 59196ca893
3 changed files with 4 additions and 7 deletions

View file

@ -33903,7 +33903,7 @@ qbs *func__readfile(qbs *filespec)
}
}
int16_t func__writefile(qbs *filespec, qbs *contents)
void sub__writefile(qbs *filespec, qbs *contents)
{
FILE *file; // file handle;
qbs *namez; // 0-term file name;
@ -33915,10 +33915,8 @@ int16_t func__writefile(qbs *filespec, qbs *contents)
if (file) {
fwrite(contents -> chr, 1, contents -> len, file);
fclose(file);
return -1; // return "success" flag true
} else {
error(QB_ERROR_PATH_FILE_ACCESS_ERROR); // error, we throw best fit
return 0; // return "success" flag false
}
}

View file

@ -107,7 +107,7 @@ extern int32 func__resizeheight();
extern void sub__title(qbs *title);
extern void sub__echo(qbs *message);
extern qbs *func__readfile(qbs *filespec);
extern int16_t func__writefile(qbs *filespec, qbs *contents);
extern void sub__writefile(qbs *filespec, qbs *contents);
extern void sub__assert(int32 expression, qbs *assert_message, int32 passed);
extern void sub__finishdrop();
extern int32 func__filedrop();

View file

@ -1024,11 +1024,10 @@ regid
clearid
id.n = qb64prefix$ + "WriteFile"
id.subfunc = 1
id.callname = "func__writefile"
id.subfunc = 2
id.callname = "sub__writefile"
id.args = 2
id.arg = MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER)
id.ret = INTEGERTYPE - ISPOINTER
id.hr_syntax = "_WRITEFILE(fileSpec$, contents$)"
regid