fileLength64(): Integer64;
The fileLength64 method of the File class returns the size of the file (in file units). Use this method to test for an empty file. When the fileLength64 method is called for a file that is not open, the following occurs.
If the kind property of the file is Kind_Unknown_Text, the file is opened to determine the kind of text and then closed. If the file cannot be opened, an exception is raised.
If the kind property of the file is not Kind_Unknown_Text, the kind of the file is assumed to be correct. If the file cannot be accessed (for example, if it does not exist), a message is output to the jommsg.log file and a value of -1 is returned.
For Unicode text, the file unit is character (not byte). For Unicode text files that contain a Unicode File Marker, the file marker specified in the unicodeBOM property is ignored.
To find the length of a Unicode file in bytes instead of file units, open the file specifying the kind property of the file as Kind_Binary.
The code fragment in the following example shows the use of the fileLength64 method.
if (cmdFile.open = 0) then fileName := cmdFile.fileName; create file; file.kind := File.Kind_Binary; file.mode := File.Mode_Input; file.fileName := fileName; photo := file.readBinary(file.fileLength); endif;