Skip to content

Filelen

Paul Squires edited this page Nov 9, 2026 · 3 revisions

Home › Operating System Functions › FileLen

FileLen

Returns the size of a named file in bytes.

Syntax

Declare Function FileLen ( filename As String ) As LongInt

Parameters

  • filename

Description

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

Remarks

Usage

#include "file.bi"

result = FileLen(filename)

or

#include "vbcompat.bi"

result = FileLen(filename)

Platform Differences

  • Linux requires the filename case matches the real name of the file. Windows, DOS and a default macOS volume are case insensitive. Path separators in Linux and macOS 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

Examples

#include "file.bi"

Dim length As LongInt

length = FileLen("file.txt")

Category: Operating System Functions
Kind: function


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally