Help Center›FreeBASIC
Pokesub
Assigns a value to a location in memory.
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 )
Parameters
| Name | Description | |
|---|---|---|
datatype | The type of data at the specified address. If omitted, UByte is assumed. | |
address | The location in memory to assign to. | |
value | The value to assign. |
Description
Poke assigns a value to a location in memory. It is equivalent to*cast(ubyte ptr, address) = valueor
*cast(datatype ptr, address) = valuedatatype is a user-defined type, Poke assigns value using the type's Operator Let.Note: When using
Poke, the -exx compiler option does not add code for null-pointer checking (no nullity test on the value of address).Remarks
Usage
Poke [ datatype, ] address, value
Differences from QB
- Only the byte form were supported in QB.
-
DEF SEGisn't needed anymore because the address space is 32-bit flat in FreeBASIC.
See also
Example
Dim i As Integer, p As Integer Ptr
p = @i
Poke Integer, p, 420
Print Peek(Integer, p)
Will produce the output:
420
Reference
- Documented in KeyPgPoke.html