FileSeek()

Syntax

FileSeek(#File, NewPosition.q [, Mode])
Description
Change the read/write pointer position in the file.

Parameters

#File The file to use.
NewPosition.q The new position relative to the beginning of the file in bytes.
Mode (optional) The seek mode. It can be one of the following values:
  #PB_Absolute: the 'NewPosition' parameter will be an absolute position with the file (default).
  #PB_Relative: the 'NewPosition' parameter will be an offset (positive or negative) relative to the current file pointer position.

Return value

None.

Example

  If CreateFile(0, "Text.txt")         ; we create a new text file
    WriteStringN(0, "Hello world")
    
    ; Rollback to the start of "world"
    FileSeek(0, 6, #PB_Absolute)
    Debug ReadString(0) ; will print "world"
    
    CloseFile(0)                       
  EndIf

See Also

Loc(), Lof()

Supported OS

All

<- FileProgress() - File Index - IsFile() ->