Seek
Seek is used to move to an alternative position in the file (from where to read or write).
Syntax
Seek(Distance, Method)
Returns
Current position in the file.
More Information
Distance is a measurement of how many bytes to move the cursor.
Method can be one of the following:
- 0 - Move cursor specified distance starting from the beginning of the file
- 1 - Move cursor specified distance starting from current position in the file
- 2 - Move cursor specified distance starting from the end of the file.
Example
This script displays the contents of the hosts file after moving the cursor 50 characters into the file:
Function Main
Dim textfile As Object
Set textfile = File.Connect("127.0.0.1")
If textfile.Open("c:\windows\system32\drivers\etc\hosts", GENERIC_READ, Open_Existing) Then
Textfile.Seek 50,0
echo(textfile.read(1024))
textfile.Close
End If
End Function