|Navigation: Language Reference > 13 - Built-in Functions >====== PEEK (read memory address) ======|
|PEEK||Reads data from a memory address.|
|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.|
|destination||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.
PEEK(ADDRESS(MemAddress),Dest1) !Read 1 byte
PEEK(ADDRESS(MemAddress),Dest2) !Read 2 bytes
PEEK(ADDRESS(MemAddress),Dest3) !Read 8 bytes