Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Store a sequence of bytes at a specified memory location.

 

Syntax

 

s = POKE$(Address, StringExpression)

s = POKE$(ASCIIZ, Address, StringExpression)

s = POKE$(STRING, Address, StringExpression)

 

Returns

 

String, the passed string expression

 

Parameters

 

Name

Type

Optional

Meaning

ASCIIZ

Command

Yes

If ASCIIZ is specified, POKE$ writes successive characters to a target address in memory until a terminating $NUL byte is found in the source string.  If no $NUL is found in the string, one is automatically appended to the target buffer.

STRING

Command

Yes

If STRING is specified, address is interpreted as a 32 bit placeholder for a dynamic string. This form allow handling dynamic strings inside UDT or using whatever 32 bit number.

Address

Numeric

No

A valid 32-bit memory address specifying the location in memory where starting to store data

StringExpression

String

No

A string expression that specifies the sequence of bytes to be stored in memory starting at the byte referenced by address

 

Remarks

 

POKE$ stores a string in consecutive bytes where the ASCII code of the first character of the string is stored in the first byte of memory, the next ASCII code is stored in the next byte of memory, and so on, until all bytes in StringExpression are stored. It is the programmer’s responsibility to ensure that POKE$ does not overrun the target memory area to avoid data corruption or protection faults.

 

Restrictions

 

See also

 

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

 

Examples

 

 

'---Example using STRING for to handle dynamic strings inside UDT structures.

Type MyType

  Name   As Long

  ID     As Long

  Notes  As Long

End Type

 

Dim MyUSer As MyType

 

POKEStringVARPTR(MyUSer.Name) , "MyName"

POKEStringVARPTR(MyUSer.ID)   , "MyID"

POKEStringVARPTR(MyUSer.Notes), "Whatever string or data or binary sequence are allowed"

 

MSGBOX 0, _

          "[" & PEEK$(StringVARPTR(MyUser.Name) ) & "]" & $crlf & _

          "[" & PEEK$(StringVARPTR(MyUser.ID)   ) & "]" & $crlf & _

          "[" & PEEK$(StringVARPTR(MyUser.Notes)) & "]" & $crlf & _

 

 

 

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software