Ok this one has me scratching my head, and my head is getting very red...
This simple test just saves a string into memory, then tries to pack that memory and unpack it, but fails to unpack.
Can anyone tell me what I am doing wrong here, Please...
Code: Select all
sText.s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
nLen.l = Len(sText)
If nLen And AllocateMemory(0,nLen, 0) And AllocateMemory(1,nLen+8, 0)
PokeS(UseMemory(0), sText)
; fails on next line
nPackLen.l = PackMemory(UseMemory(0), UseMemory(1), nLen, 9)
If nPackLen <> 0
AllocateMemory(2,nLen+8, 0)
nUnPackLen.l = UnpackMemory(UseMemory(1), UseMemory(2))
sNewText.s = PeekS(UseMemory(2),nUnPackLen)
Debug "Result:" + sNewText
Else
Debug "Pack Mem Failed"
EndIf
Else
Debug "No Mem Allocated"
EndIf

