Wiki source for KeyPgSeekset


Show raw source

{{fbdoc item="title" value="SEEK (Statement)"}}----
Sets the position of the next read/write operation on a file

{{fbdoc item="syntax"}}##
**Seek** [#]//filenum//, //position//
##
{{fbdoc item="param"}}
##//filenum//##
file number of an opened a file
##//position//##
the new position for i/o operations

{{fbdoc item="desc"}}
Sets the position at which the next read or write operation on a file will occur.

The position is given in records if the file was opened in ##[[KeyPgRandom|Random]]## access mode, in bytes in any other case. The position is 1 based -- the first record of a file is at position 1.

The ##[[KeyPgSeekreturn|Seek]]## function is used to get the position of the next read or write operation.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/fileio/seek-statment.bas"}}%%(freebasic)
' e.g. if you want to skip to the 100th byte in the file for reading/writing:

dim f as integer

f = freefile
open "file.ext" for binary as #f

seek f, 100

close #f
%%

{{fbdoc item="diff"}}
- None

{{fbdoc item="see"}}
- ##[[KeyPgSeekreturn|Seek (Function)]]##
- ##[[KeyPgOpen|Open]]##

{{fbdoc item="back" value="CatPgFile|File I/O Functions"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode