FileSeek()

Syntax

FileSeek(NewPosition)
Description
Change the read/write pointer position inside the current file. The parameter 'NewPosition' must be given in Bytes.

  file$ = OpenFileRequester("Select a file","","Text (.txt)|*.txt|All files (*.*)|*.*",0)
  If file$
    If ReadFile(0,file$) 
      length = Lof()                     ; read length of file
      FileSeek(length - 10)              ; set the file pointer 10 chars from end of file
      Debug "Position: " + Str(Loc())   ; show actual file pointer position
      *MemoryID = AllocateMemory(10)     ; allocate the needed memory for 10 bytes
      If *MemoryID
        bytes = ReadData(*MemoryID, 10)  ; read this last 10 chars in the file
        Debug PeekS(*MemoryID)
      EndIf
      CloseFile(0)
    EndIf
  EndIf  

Supported OS

All

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