PEEK (read memory address)

Top  Previous  Next




Reads data from a memory address.


A numeric constant, variable, or expression (evaluated to a LONG) that specifies a memory address. This parameter should always use the ADDRESS procedure, to ensure the correct address is used.


The label of a variable to receive the contents of the memory location.

The PEEK statement reads the memory address specified by address and copies the data found there into the destination variable. PEEK reads as many bytes as are required to fill the destination variable.

It is easily possible to create a General Protection Fault (GPF) if you PEEK at an incorrect address, so great care should be taken when using PEEK. There are usually Windows API procedures that will do whatever you require of PEEK and these should be used in preference to PEEK.


MemAddress       LONG

Dest1            BYTE

Dest2            SHORT

Dest3            REAL

KeyboardFlag     BYTE



  PEEK(ADDRESS(MemAddress),Dest1)      !Read 1 byte

  PEEK(ADDRESS(MemAddress),Dest2)      !Read 2 bytes

  PEEK(ADDRESS(MemAddress),Dest3)      !Read 8 bytes


See Also: