Description: This function changes and returns the current position within a stream. The return value is the current stream position after the seek is done.
Returns: Numeric
Usage: Script
Format: Seek(Stream, Position[, Mode])
Parameters: Stream { Stream } { required } { no default }
Any expression that returns the stream to do the Seek on
Position { numeric } { required } { no default }
Any numeric expression that returns either the absolute position, or a relative amount to move the position, depending on Mode. If the mode is relative, this number may be negative (i.e. earlier in the stream).
Mode { short (0 or 1) } { optional } { default: 0 }
A short value that denotes which type of positioning to do. If equal to 0, the stream position is changed to Position (absolute mode). If equal to 1, the Position is added to the current stream position (relative mode ).
Comments: This allows repositioning within a stream.
This function can be used to find the current stream position by setting the last two parameters to "0,1".
Example:
If ! Valid(strm);
[
strm = BuffStream("ABCDEF");
Seek(strm, 3, 0);
SRead(strm, "%1c", streamData);
]
The variable streamData now contains the string "D".
See Also:
BuffStream | CloseStream | FileStream | GetStreamLength | SRead | StreamEnd | SWrite