/
getFilePos
getFilePos
Description
Gets the current file position
Use this command to get how far you are into a file. The value is in bytes and you can use the file position value to "point" to other parts of the file. This command only makes sense in files opened in binary mode.
Functional area
Disk I/O
Command syntax
Syntax
getFilePos fileID |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
fileID | int | yes | The fileID is usually a variable created earlier in the script with the fileOpen command |
Flags
None
Return value
integer
Examples
int $fileID; int $filePos; string $str = "}"; $fileID = `fileOpen "C:/testfile.log" "w"`; //set the file position to the 27th position... setFilePos $fileID 27; // get the file position and print it out to the command log and // the 27th space in the text file. $filePos = `getFilePos $fileID`; writeInt $fileID $filePos; //close the file. fileClose $fileID; // now if you open "C:/testfile.log" you should see "27" in the // 27th space counting from 0.
Additional information
Related commands
, multiple selections available,