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 ) |
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 fragment advance the file writing position to byte offset 80:
|
-- result: pos = 54 |
|
-- advance the file position by 26 bytes |
|
-- result: pos = 80 |