[ Back ]
NaaLaa supports both text and binary files.
procedure create file file_id, filename$[, binary]
procedure write file file_id[, expr [, expr ...]]
procedure wln file file_id[, expr [, expr ...]]
procedure write8 file_id, data
procedure write16 file_id, data
procedure write32 file_id, data
procedure writef file_id, data#
procedure writes file_id, data$
procedure open file file_id, filename$[, binary]
function read(file_id)
function read#(file_id)
function read$(file_id)
function read8(file_id)
function read16(file_id)
function read32(file_id)
function readf#(file_id)
function reads$(file_id)
function file(file_id)
function eof(file_id)
function exists(filename$)
function openfile$(extension$)
function savefile$(extension$)
procedure free file file_id
function datafolder$()
function download(url$, filename$, maxSize, timeout)
Create file file_id with the name filename for writing. If a file with the same name already exists, it is replaced by the new file. If binary is set to false (default), the file will become a text file, else it will become a binary file.
Write a number of arbitrary expressions to file file_id. This only works on text files.
Write an 8 bit (byte) value, data, to file file_id. This only works on binary files.
Write a 16 bit (short) value, data, to file file_id. This only works on binary files.
Write a 32 bit (long) value, data, to file file_id. This only works on binary files.
Write a float value, data, to file file_id. This only works on binary files.
Write a string, data, to file file_id. In the file, the string is a character (byte) sequence terminated by null (a byte with the value 0). This only works on binary files.
Open file file_id with the name filename for reading. If binary is set to false (default), the file will be treated as a text file, else it is assumed to be a binary file.
Read and return an integer value from file file_id. This only works on text files.
Read and return a float value from file file_id. This only works on text files.
Read and return a string from file file_id. This only works on text files.
Read and return an 8 bit (byte) value from file file_id. This only works on binary files.
Read and return a 16 bit (short) value from file file_id. This only works on binary files.
Read and return a 32 bit (long) value from file file_id. This only works on binary files.
Read and return a float value from file file_id. This only works on binary files.
Read and return a string from file file_id. This only works on binary files.
Return true if file file_id has been opened/created.
Return true if end of file file_idhas been reached.
Return true if a file with the name filename exists.
Show a standard windows dialog for opening a file. The selected filename is returned. If extension is not an empty string, only files with the specified extension (ex. "txt") will be visible.
Show a standard windows dialog for saving a file. The selected filename is returned. If extension is not an empty string, only files with the specified extension (ex. "bmp") will be visible.
Close file file_id. All files are automatically closed when the program exits.
Return path to the user's home directory.
filename$ = datafolder$() + "mygame_savefile.bin"
create file 0, filename$
...
Download a file specified by url. No matter what url says, the destination filename, on disc, will be filename. maxSize is the maximum size of the file to be downloaded. timeout is unused, set it to 0.
You can use this command not only to download files, but also to fetch the output of, for example, php scripts (in that case, the downloaded file will be a text file).
[ Back ]