To know what the error code means, check the Error enum documentation. 7 is for ERR_FILE_NOT_FOUND
. To read a file, it needs to exist already. To create the file if it doesn't exist (and truncate it if it exists), use the File.WRITE
mode instead of File.READ
.
Call file_exists(path)
from your File instance to check whether a file exists at the given path.