CFile:Seek
The Seek method sets the byte offset of the file read/write position. Three starting point options are provided as enumerated values: eBegin, eCurrent, and eEnd.
nPos = CFile:Seek( nBytes, nFromWhere ) |
nBytes is the distance to move the file pointer.
nFromWhere specifies the position from which to move (see Remarks).
On success, bSuccess returns nPos, the byte offset of the file position.
On failure, this method returns -1.
The nFromWhere argument has 3 possible values that specify the reference point from which to offset the file pointer. You can specify the reference point using predefined CFile member names or you can use the numeric values listed in the table below. Note that the CFile Member values are specified using the particular instance of the class, such as F, and not the class name CFile. In addition, a dot is used, not a colon, to separate the class instance name and the member name. For example, if a CFile instance is named F, then use F.eBegin. Alternatively, you can use the value 0, which means the same thing. However, using the value 0 makes the script less "user friendly".
Values of the nFromWhere Parameter
CFile Member |
Value |
Reference Position |
eBegin |
0 |
Beginning of file |
eCurrent |
1 |
Current position |
eEnd |
2 |
End of file |
Suppose a CFile F exists and that the file pointer is at byte offset 54. The following script advance the file writing position to byte offset 80:
|
-- result: pos = 54 |
|
-- advance the file position by 26 bytes |
|
-- result: pos = 80 |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.