VARPTR()
This page was last modified 16:59, 16 May 2020 by Mars2000you. Based on work by Gdx and NYYRIKKI and others.

Contents

Effect

Returns a pointer to either

  • the beginning of FCB (File Control Block) associated with the specified file number
  • or the actual memory address of the first byte of the variable passed

The pointed variable is stored on 2, 3, 4 or 8 bytes depending on the variable type: the numbers are coded on 2 bytes for integer, 4 for simple precision or 8 for double precision. In case the variable is string the address of string pointer is returned, this string pointer contains length & address of the string (3 bytes).

See here for more info about the format of each type.

Syntaxes

  • VARPTR(<VariableName>)
  • VARPTR(#<FileNumber>)

Parameters

<VariableName> can be any variable in use.

<FileNumber> is the number of opened file: 1 up to 15 depending on MAXFILES or 0 for the tempory file FCB.

Example

10 X=5
20 PRINT VARPTR(x)
 
RUN
-32735

Related to

CLOSE, MAXFILES, OPEN

Compatibility

MSX-BASIC 1.0 or higher