Seek
This function sets the current position of this fileHandle to the given offset according to whence which is optional. By default whence is 0.
Function
void Seek(fileHandle: Integer, offset: iIteger, whence: Integer (OPTIONAL));
Parameters
Name | Type | Description |
---|---|---|
fileHandle | Integer | The handle of the file which to be associate (the handle is returned by OpenFileForReading) |
offset | Integer | Integer Offset value to set the current position |
whence | Integer | Position used as reference for the offset. It is specified by one of the following to be used as arguments for this function:
|
Return Value
None
Example
function OnSimulationStart()
{
// Open file for reading
var handle = OpenFileForReading("C:\\Data\\ChutesMap.csv");
//Seek from beginning of file
Seek(handle, 200000, 0);
var _line = ReadLine(handle);
LogDebug("Seek from beginning of file: " + _line);
//Seek from current position of file
Seek(handle, 299999, 1);
var _line1 = ReadLine(handle);
LogDebug("Seek from current position of file: " + _line1);
//Seek from end of file
Seek(handle, 200000, 2);
var _line2 = ReadLine(handle);
LogDebug("Seek from end of file: " + _line2);
CloseFile(handle);
}