Poke
Assigns a value to a location in memory.
Declare Sub Poke ( ByVal address As Any Ptr, ByRef value As UByte )
Declare Sub Poke ( datatype, ByVal address As Any Ptr, ByRef value As datatype )
Poke [ datatype, ] address, value
datatype
Poke assigns a value to a location in memory. It is equivalent to
Will produce the output:
Syntax
Declare Sub Poke ( ByVal address As Any Ptr, ByRef value As UByte )
Declare Sub Poke ( datatype, ByVal address As Any Ptr, ByRef value As datatype )
Usage
Poke [ datatype, ] address, value
Parameters
datatype
The type of data at the specified address.
addressThe location in memory to assign to.
valueThe value to assign.
Description
Poke assigns a value to a location in memory. It is equivalent to
*cast(ubyte ptr, address) = value
When datatype is a user-defined type, Poke assigns value using the type's Operator Let.or
*cast(datatype ptr, address) = valueExample
Dim i As Integer, p As Integer Ptr
p = @i
Poke Integer, p, 420
Print Peek(Integer, p)
p = @i
Poke Integer, p, 420
Print Peek(Integer, p)
Will produce the output:
420
Differences from QB
- Only the byte form were supported in QB.
- DEF SEG isn't needed anymore because the address space is 32-bit flat in FreeBASIC.
See also