file_text_open_append

这个函数打开带有 写入 指定文件名的文本文件 (如果文件不存在,则创建该文件),返回文件的唯一 id,该文件应该存储在一个变量中,因为它将用于处理该文件的所有进一步操作。要写入的文件中的位置设置为文件包含的最后一行文本,因此不会覆盖任何现有数据。

In the case of an error, the function will return -1. However, in some cases where the file could not be loaded (like an invalid filename being passed), the function may still return a file ID, in which case the return value of the file closing function will be false.

NOTE You can only have a maximum of 32 files open at any one time. You should also always close files when finished as this writes the information and frees the memory associated with the file.

WARNING This may not work as you expect due to GameMaker being sandboxed! Please see the section on The File System for more information.

 

语法:

file_text_open_append(fname);

参数类型描述
fnameString要附加到的文件的名称。

 

返回:

Text File ID or -1

 

例子:

file = file_text_open_append(working_directory + "save.txt");

这将从与游戏相同的目录中打开 "save.txt",并将文件 ID 存储在变量 "file" 中。