Peek - Read a byte from a memory address

Top  Previous  Next

Syntax

 

<nByte> := Peek( <nAddress> )

 

Parameters

 

<nAddress>

 

Memory address to be read. The address is a  LONGvalue.

 

Return value

 

The BYTE value stored at address <nAddress> in memory. The range of this value 0 to 255.

 

Description

 

Peek reads the BYTE value stored in memory at the given address <nAddress>.

 

Classification

 

Core

 

Category

 

Pointers and Memory

 

Quick Info

 

Library: cckptcor.lib / cckptcor.dll

 

See also

 

Poke, PeekLong, PokeLong

 

Example

 

 

#INCLUDE "CockpitCoreLibs.ch"

 

FUNCTION Main

 

LOCAL address

 

* Allocate a byte of memory

address := LockNullString(1)

 

* That should return a zero

? Peek(address)

 

* Write a value to this address

Poke(address,17)

 

* Check if it worked

? Peek(address)

 

RETURN NIL