FileLen (function)

Syntax

FileLen(filename$)

Description

Returns a Long representing the length of filename$ in bytes.

Comments

This function is used in place of the LOF function to retrieve the length of a file without first opening the file. A runtime error results if the file does not exist.

Example

This example checks to see whether there is a c:\autoexec.bat file and, if there is, displays the length of the file.

Sub Main()
  file$ = "c:\autoexec.bat"
  If FileExists(file$) And FileLen(file$) <> 0) Then
    b% = FileLen(file$)
    MsgBox "'" & file$ & "' is " & b% & " bytes."
  Else
    MsgBox "'" & file$ & "' does not exist."
  End If
End Sub

See Also

GetAttr (function); FileAttr (function); FileParse$ (function); FileExists (function); Loc (function).

More information

F