seek

Locates a position in a file, to be used by the read from file and write to file commands.

# Metadata

Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:

# Syntax

seek {to | rel[ative]} byteNumber in file filePath

# Params

- byteNumber : An integer representing the position in the file. - filePath : The filePath specifies the name and location of the file you want to seek in. It must be the same as the path you used with the open file command. The filePath is case-sensitive, even on platforms where file names are not case-sensitive.

# Examples

seek to 100 in file "test.txt"

seek relative -10 in file "test.txt"

put specialFolderPath("desktop") & "/test.txt" into tFile open file tFile for write write "123456789--" to file tFile seek to 9 in file tFile write "10" to file tFile close file tFile

# Description

Use the seek command to prepare to read from or write to an open file at a specific position in the file.

The next read from file or write to file command will start reading or writing at the position specified by the seek command.

Theform sets the file position to byteNumber bytes from the start of the file. Theform sets the file position to byteNumber bytes from the current position. The position is set by either a previous seek command, or a read from file or write to file command.

# Tags

# See

- **command:** close file, read from file, write to file - **glossary:** command, byte - **keyword:** file, relative