PEEK$

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > BuiltIn Functions > Memory handling and pointers >

PEEK$

 

Description

 

Return sequence of bytes at a specified memory location assuming memory pointer point at an ASCIIZ null terminated string.

 

Syntax

 

s = PEEKZ$(address [, count])

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

Address

Numeric

No

A valid 32-bit memory address specifying the location in memory where data retrieval should begin

Count

Numeric

No

A numeric expression that specifies the number of consecutive bytes to be read from memory starting at address.

If count is omitted, bytes till the next $NUL char will be automatically determined.

 

Remarks

 

PEEKZ$ reads successive characters from an ASCIIZ buffer of the specified size, until a terminating $NUL (CHR$(0)) byte is found.  Since ASCIIZ strings must contain a terminating $NUL, the maximum length of the returned string is 1 character less than the specified size.

 

This function is useful to get back strings from C functions returning a pointer to an ASCIIZ string: (const char*)

 

Restrictions

 

See also

 

STRPTR, VARPTR, POKE$, POKE, PEEK$, PEEK

 

Examples