/
setFilePos
setFilePos
Description
Sets the current file position.
Use this command to set your position in a file. The value is in bytes from the origin, which you specify in the origin
argument. The file position can be set past the end of the file in Write mode.
This command only makes sense in files opened in binary mode.
Functional area
Disk I/O
Command syntax
Syntax
setFilePos fileID offset [-cur] [-end] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
origin | string | Origin that the offset is defined against, either beg for the beginning of the file, cur for the current file position, or end for the end of the file. | |
offset | int | Offset in bytes from the origin to set the file position to | |
fileID | int | ID of file previously opened with fileOpen |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
cur | 0 | — | end | — |
end | 0 | — | cur | — |
Return value
void
Examples
int $fileID; int $filePos; $fileID = `fileOpen "C:/testfile.log" "r"`; // Read a value from the file, which "points" to another part of the // file. This could be done in a file "header" section $filePos = `readInt $fileID`; print $filePos; // Move to the file position "pointed" to earlier, so we can do some // reading setFilePos $fileID $filePos;
Additional information
Related commands
, multiple selections available,