Equinox Online Help - Language Reference - A to Z

Home

FilePosition

Applies to
SyntaxFilePosition (HandleItem)
Action[Function] Returns the current read/write position in a random or sequential file.
ScopeUsable anywhere
Notes

The File I/O system automatically maintains a pointer to a position within a file. eg If you read ten characters from a file, the file pointer for that particular file will then be positioned at the eleventh character. The FilePosition function allows you to determine where the file pointer is within an open file. The HandleItem parameter must be an Equinox variable type Handle and is the handle of the file which was opened with the FileOpen statement.

The system workarea SysError is set to a non-zero value if an error occurs, otherwise zero.

CategoryFile IO
See Also FileClose, FileCloseAll, FileDelimiters, FileInput, FileInputLine, FileLock, FileMovePosition, FileOpen, FilePosition, FilePrint, FileRead, FileReadLine, FileReadBinary, FileReadFile, FileUnlock, FileWrite, FileWriteBinary, FileWriteFile
Example

The first example goes to the end of a random file and uses FilePosition to return the length of the file. You can also determine the file length by using the FileDetails statement.

FileMovePosition hTest, -1

Alert "File Length =" & FilePosition(hTest)