This commit is contained in:
lenheart
2024-10-11 23:56:27 +08:00
parent 91ff5af4f1
commit e82c5ceee3
24 changed files with 2033 additions and 36 deletions

View File

@@ -16,6 +16,7 @@ class IO extends Base_C_Object {
_Fseek_Address = Module.getExportByName(null, "fseek");
_Ftell_Address = Module.getExportByName(null, "ftell");
_Rewind_Address = Module.getExportByName(null, "rewind");
_Flush_Address = Module.getExportByName(null, "fflush");
@@ -25,7 +26,7 @@ class IO extends Base_C_Object {
local FileObj = Sq_CallFunc(_Fopen_Address, "pointer", ["pointer", "pointer"], Str_Ptr(FileName), Str_Ptr(Modes));
if (FileObj) {
base.constructor(FileObj);
} else error("文件打开错误! FileName: " + FileName);
} else throw("文件打开错误! FileName: " + FileName);
}
//读取一行
@@ -68,6 +69,9 @@ class IO extends Base_C_Object {
Sq_CallFunc(_Fputs_Address, "int", ["pointer", "pointer"], Buffer.C_Object, this.C_Object);
}
function Flush() {
Sq_CallFunc(_Flush_Address, "pointer", ["pointer"], this.C_Object);
}
//关闭文件
function Close() {