Skip to content

FILELEN


Finds the length of a file given its filename

Syntax

` declare function FileLen ( filename as string ) as longint

`

Usage

#include "file.bi"
result = FileLen(filename)

or

#include "vbcompat.bi"
result = FileLen(filename)

Parameters

filename

A string argument specifying the filename of the file whose length to return.

Description

Returns the size in bytes of the file specified by filename.

Examples

start GeSHi

vb
#include "file.bi"
Dim length As LongInt
length = FileLen("file.txt")

end GeSHi

Platform Differences

  • Linux requires the filename case matches the real name of the file. Windows and DOS are case insensitive.
  • Path separators in Linux are forward slashes / . Windows uses backward slashes \ but it allows for forward slashes . DOS uses backward \ slashes.

Differences from QB

  • New to FreeBASIC. Existed in Visual Basic.

See also

  • Lof

Back to DocToc

Translated from FreeBASIC official docs. Contact us for removal if infringed.
FreeBASIC is an open-source project, not affiliated with Microsoft