BASELEN

Top  Previous  Next

Syntax

size = BASELEN(variable)

size = BASELEN(UDT)

Description

Returns the length in bytes of a variable or UDT.

Parameters

variable - Any defined variable.

UDT - The name of a user data type as specified in the TYPE statement.

Return value

Depends on the type of variable:

FILE, BFILE - Returns the length of the file, file must have been opened with OPENFILE.

MEMORY - Returns the size of the memory allocated with ALLOCMEM.

UDT - Returns the actual size a UDT takes in memory using the packing value specified in the TYPE statement

STRING - Returns the string length, not the DEF'ined length.

Remarks

For a MEMORY variable only memory obtained with ALLOCMEM will return a size.

Unlike the LEN command BASELEN returns the element size for arrays instead of the entire array length. BASELEN is used internally by many commands.

See Also: ALLOCMEM, DEF, TYPE, LEN

Example usage

mystring = "This is a test"
PRINT BASELEN(mystring)