Difference between revisions of "MEMNEW"

From QB64 Wiki
Jump to navigation Jump to search
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…')
 
imported>Clippy
m
Line 6: Line 6:
  
  
* The ''memory block'' value created holds the starting OFFSET, SIZE, TYPE and ELEMENTSIZE. If the SIZE is 0, the block was not created!
+
* The ''memory block'' value created holds the starting OFFSET, SIZE, TYPE and ELEMENTSIZE.  
 +
* The ''byte size'' parameter is the desired byte size of the memory block.
 +
* '''If the read only memory block.SIZE is 0, the memory block was not created!'''
  
  

Revision as of 22:58, 21 April 2012

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.
  • The byte size parameter is the desired byte size of the memory block.
  • If the read only memory block.SIZE is 0, the memory 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