Lof()

Syntax

Length.q = Lof(#File)
Description
Returns the length of the specified file.

Parameters

#File The file to use.

Return value

Returns the length of the file in bytes.

Example


  file$ = OpenFileRequester("Select a file","","Text (.txt)|*.txt|All files (*.*)|*.*",0)
  If file$
    If ReadFile(0, file$)
      length = Lof(0)                            ; get the length of opened file
      *MemoryID = AllocateMemory(length)         ; allocate the needed memory
      If *MemoryID
        bytes = ReadData(0, *MemoryID, length)   ; read all data into the memory block
        Debug "Number of bytes read: " + Str(bytes)
      EndIf
      CloseFile(0)
    EndIf
  EndIf

See Also

Loc(), FileSeek(), FileSize()

Supported OS

All

<- Loc() - File Index - OpenFile() ->