File Methods

The methods defined in the File class are summarized in the following table.

Method Description
close Closes an open file
commit Commits any outstanding updates that have been cached in memory to the file
currentOffset Returns the current offset as an Integer value (in file units)
currentOffset64 Returns the current offset as an Integer64 value (in file units)
currentOffsetDec Returns the current offset as a Decimal value (in file units)
endOfFile Returns true if the end of the file has been reached
errorCode Returns the last operating system error code as an integer value
extractSort Sorts the contents of the file into the specified sort order
fileLength Returns the size of the file as an Integer value (in file units)
fileLength64 Returns the size of the file as an Integer64 value (in file units)
fileLengthDec Returns the size of the file as a Decimal value (in file units)
isAvailable Returns true if the specified file is available
isOpen Returns true if the specified file is currently open
lastAccessed Returns the TimeStamp of the last access of the file
lastModified Returns the TimeStamp of the last modification of the file
open Opens the file
openInput Opens the file for input
openOutput Opens the file for output
peek Returns the file record at the specified position
purge Deletes the file and its contents from disk
readBinary Returns the specified number of bytes from the current file offset
readLine Returns the next line in the file
readString Returns the specified number of characters from the file
rename Changes the name of the file
seek Repositions the file pointer at a specified Integer offset from the beginning of the file
seek64 Repositions the file pointer at a specified Integer64 offset from the beginning of the file
seekDec Repositions the file pointer at a specified Decimal offset from the beginning of the file
timeCreated Returns the TimeStamp of the date and time at which the file was created
tryOpen Opens the file and returns true if successful
writeBinary Writes the specified number of bytes to the file
writeLine Writes the specified line to the file
writeString Writes the specified string to the file