Loc()

Syntax

Position.q = Loc(#File)
Description
Returns the read/write pointer position in the file.

Parameters

#File The file to use.

Return value

Returns the file pointer position relative to the start of the file in bytes.

Example

  If CreateFile(0, "Text.txt")         ; we create a new text file
    WriteString(0, "Hello world")
    
    Debug Loc(0) ; will print '11'
    
    FileSeek(0, 2, #PB_Absolute) ; Change the file pointer position
    Debug Loc(0) ; will print '2'
    
    CloseFile(0)                       
  EndIf

See Also

FileSeek(), Lof()

Supported OS

All

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