The file api can be used for different kind of file I/O.
'file file_open(f : string, r : string)
Call the C function fopen with the file path and access rights.
Return the opened file or throw an exception if the file couldn't be open.
void file_close('file) Close an file. Any other operations on this file will fail
string file_name('file) Return the name of the file which was opened
int file_write('file, s : string, p : int, l : int)
Write up to l chars of string s starting at position p.
Returns the number of chars written which is >= 0.
int file_read('file, s : string, p : int, l : int)
Read up to l chars into the string s starting at position p.
Returns the number of chars readed which is > 0 (or 0 if l == 0).
void file_write_char('file, c : int) Write the char c. Error if c outside of the range 0..255
int file_read_char('file) Read a char from the file. Exception on error
void file_seek('file, pos : int, mode : int) Use fseek to move the file pointer.
int file_tell('file) Return the current position in the file
bool file_eof('file) Tell if we have reached the end of the file
void file_flush('file) Flush the file buffer
string file_contents(f : string) Read the content of the file f and return it.
'file file_stdin() The standard input
'file file_stdout() The standard output
'file file_stderr() The standard error output