FLEN

Syntax

FLEN [(#channel)] or

FLEN (\file)(Toolkit II and THOR only)

Location Toolkit II, THOR XVI, BTool

This function returns the length of a file in bytes. If the second version is used, then Toolkit II’s default data device and sub-directories will be supported, meaning that the command will consult the default data directory if necessary (see DATAD$).

If you use the first version however, you will first of all need to open a channel. If you do not supply a channel number, then the default used by the function is #3.

NOTE 1

The space on disks, cartridges, ramdisks and all other media where files can be stored is divided up into sectors, which are normally 512 bytes long. A file does not occupy the number of bytes returned by FLEN but a certain number of sectors for the contents of the file itself, a few bytes for the file header and the directory entries (sector map, etc). The total number of sectors which are occupied by the file data are:

sectors = 2 + CEIL(FLEN(\file)/512)

NOTE 2

If the second syntax does not work, update your Toolkit.

CROSS-REFERENCE

FILE_LEN has a slightly different syntax. FILE_TYPE, FILE_DAT, FILE_POS, FNAME$, FPOS, FTYP, FUPDT and FXTRA hold other information about a file. HEADR and HEADS allow you to directly access a file header.