Lof()

语法

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

参数

#File The file to use.

返回值

Returns the length of the file in bytes.

示例


  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

参阅

Loc(), FileSeek(), FileSize()

已支持操作系统

所有

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