file_open_read (
STRING* name);
Opens a file in the save_dir for reading.
file_open_game (
STRING* name);
Opens a file in the work folder for reading.
If a path is given with the file name, the file is opened from that path instead of the save_dir or work folder. The function returns a file handle - that is a unique number
to identify the opened file. The file handle is used by other functions to
access that file. If the file can't be opened - if it does not exist, for instance
- 0 is returned instead.
Parameters:
name - file name with or without path, STRING* or char*.
Returns:
| handle |
File handle |
| 0 |
Can't open file |
Remarks:
If file handles are not
defined as non-savable variables, they become invalid after a
game_load function.
Example:
var filehandle_n;
...
filehandle_n = file_open_read("adress.txt"); // opens the file address.txt to read
See also:
file_open_write, file_open_append,
file_close, file_var_write,
file_var_read, file_str_write,
file_str_read, file_chr_read,
file_asc_write, file_asc_read
► latest version online