QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _MEMGET function returns a value from a specific memory block name at the specified OFFSET using a certain variable type.

Syntax

returnValue = _MEMGET(memoryBlock, bytePosition, variableType)

Parameter(s)

Description

Example(s)

DEF SEG and VARPTR are no longer necessary to do things in memory just like POKE and PEEK do.


DIM o AS _MEM
o = _MEM(d&) 'OLD... o% = VARPTR(d&)
_MEMPUT o, o.OFFSET + 1, 3 AS _UNSIGNED _BYTE 'a POKE
v = _MEMGET(o, o.OFFSET + 1, _UNSIGNED _BYTE) 'a PEEK
PRINT v     'prints 3
PRINT d&    'prints 768 because the 2nd byte of d& has been set to 3 or 3 * 256
_MEMFREE o

Explanation: The memory block and OFFSET are given by _MEMPUT and the _MEMGET function, with the designated type.

See Also