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 statement reads a portion of a memory block at an OFFSET position into a variable, array or user defined type.

Syntax

_MEMGET memoryBlock, bytePosition, destinationVariable

Description

Example(s)

Shows how to read the PSET color values from a program’s SCREEN memory to an array.


SCREEN 13
PSET (0, 0), 123
PSET (1, 0), 222 'create screen image

'here is an array
DIM screen_array(319, 199) AS _UNSIGNED _BYTE 'use screen dimensions from 0

'here's how we can copy the screen to our array
DIM m AS _MEM
m = _MEMIMAGE  '0 or no handle necessary when accessing the current program screen
_MEMGET m, m.OFFSET, screen_array()

'here's the proof
PRINT screen_array(0, 0) 'print 123
PRINT screen_array(1, 0) 'print 222 
END 

See Also