fileioThis module provides file input and output operations
' Simple example how to get the resolution of a JPEG image
import fileio
f = file("image.jpg", file_binary + file_read)
if !is_nothing(f)
height = f.readbyte(0xa3) * 0x100 + f.readbyte(0xa4)
width = f.readbyte(0xa5) * 0x100 + f.readbyte(0xa6)
writeln("Resolution: " & width & " x " & height)
f.close()
else
writeln("Failed to open the file")
endif
file_append — File mode: Append. Set the position indicator to the end of the file before each output operationfile_binary — File mode: Binary. Open file as binary rather than textfile_read — File mode: Read. Allow input operations on the filefile_truncate — File mode: Truncate. When the file is opened, the old contents are immediately removedfile_write — File mode: Write. Allow output operations on the file
deletefile() — Remove a filedeletefolder() — Remove a folderfilecontent() — Get content of a text filefileexists() — Check whether a file existsfileput() — Write content to a filefilesize() — Get size of a file (in bytes)getabsolutepath() — Get absolute pathgetcurrentdirectory() — Get current working directorygetcurrentfile() — Get current executed .fio filegetfilename() — Get file name of a pathgetfoldername() — Get folder name of a pathlistdirs() — Get list of directories of a specified pathlistfiles() — Get list of files of a specified path
file — Provides file operations
construct() — The constructor. Create an instance of class file and open a file close() — Close the file associated with the handle and disassociate it eof() — Check whether file pointer is at the end-of-file (EOF) or not read() — Read a single sequence from the opened file readbyte() — Read a single byte from the opened file (binary mode) readln() — Read a single line from the opened file readstring() — Read multiple bytes from the opened file and convert them to string (binary mode)