' The string to be processed should have known length.
' or:
' Change 12 to a higher number and the HEX representation stores the trailing whitespace.
' Trailing whitespace in an ordinary string can be truncated using RTRIM$().
TheString = "Hello World!"
' Prepare MEM block.
' Convert string to HEX and print.
Hx$ = MemToHex(m)
' Overwrite string.
TheString = "Overwritten?"
' Restore string from MEM and print the result.
HexToMem Hx$, m
'PRINT RTRIM$(TheString); "..."
' Free the memblock (redundant at END but good practice).
s = ConvertOffset(m.SIZE) - 1
MemToHex$ = MemToHex$ + h$
m
= _MEM(value
) 'Point it to use value ' On 64 bit OSes, an OFFSET is 8 bytes in size. We can put it directly into an Integer64.
_MEMGET m
, m.OFFSET
, ConvertOffset&&
' Get the contents of the memblock and put the values there directly into ConvertOffset&&. 'However, on 32 bit OSes, an OFFSET is only 4 bytes. We need to put it into a LONG variable first.
_MEMGET m
, m.OFFSET
, temp&
' Like this: ConvertOffset&& = temp& ' And then assign that long value to ConvertOffset&&.