MEMNEW

From QB64 Wiki
Revision as of 22:55, 21 April 2012 by imported>Clippy (Created page with 'The '''_MEMNEW''' function allocates new memory and returns a _MEM memory block referring to it. {{PageSyntax}} ::: memory_block = _MEMNEW(''byte_size%%'') * The ''memory…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The _MEMNEW function allocates new memory and returns a _MEM memory block referring to it.


Syntax

memory_block = _MEMNEW(byte_size%%)


  • The memory block value created holds the starting OFFSET, SIZE, TYPE and ELEMENTSIZE. If the SIZE is 0, the block was not created!


Example:

DIM m AS _MEM DIM f AS STRING * 5 m = _MEMNEW(5) 'create new memory block of 5 bytes a = 12345 _MEMPUT m, m.OFFSET, a _MEMGET m, m.OFFSET, b PRINT b c$ = "Doggy" _MEMPUT m, m.OFFSET, c$ _MEMGET m, m.OFFSET, d$ _MEMGET m, m.OFFSET, f e$ = _MEMGET(m, m.OFFSET, STRING * 5) PRINT "d$ = ";d$ PRINT "e$ = ";e$ PRINT "f = ";


See also:



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page