t = MemToTable(id, type[, table])
type
argument specifies the data type
of the elements that should be read from the memory block and stored inside
a table. This can be either #BYTE
(1 byte), #SHORT
(2 bytes), #INTEGER
(4 bytes),
#FLOAT
(4 bytes), or #DOUBLE
(8 bytes).
The optional table
argument can be used to set additional parameters for
the operation. The following table fields are currently recognized:
Items:
type
argument
to #INTEGER
and set Items
to 4, 16 bytes will be read from the memory
block. Defaults to all items that are in the memory block.
Offset:
MemToTable()
should start to read elements.
Defaults to 0 which means read from the beginning of the memory block.
Signed:
True
, MemToTable()
will treat all elements of type
#BYTE
, #SHORT
, and #INTEGER
as signed values. Defaults to False
.
EndianSwitch:
True
, MemToTable()
will switch byte order for all
multi-byte data types. This can be useful if you need to convert between
big and little endian values. Defaults to False
.
To convert a table back into a memory block, use the TableToMem() function. See TableToMem for details.
Items
tagAllocMem(1, 26) For Local k = 0 To 25 Do Poke(1, k, 'A' + k, #BYTE) Local t = MemToTable(1, #BYTE) For Local k = 0 To 25 Do Print(Chr(t[k]))This prints the alphabet from a memory block source.