| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== PEEK (read memory address) ====== | [[path return current directory .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[pencolor return line draw color .htm|{{btn_next_n.gif|Next page}}]] | | || **PEEK(**//address//,//destination//**)** {{blk2blue.jpg|blk2blue.jpg}} | **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. **Example:** **MemAddress       LONG** **Dest1            BYTE** **Dest2            SHORT** **Dest3            REAL** **KeyboardFlag     BYTE** **  CODE** **   ****PEEK****(ADDRESS(MemAddress),Dest1)      !Read 1 byte** **   ****PEEK****(ADDRESS(MemAddress),Dest2)      !Read 2 bytes** **   ****PEEK****(ADDRESS(MemAddress),Dest3)      !Read 8 bytes** **See Also:** [[poke write to memory address .htm|POKE]] [[address return memory address .htm|ADDRESS]]