01-01-2025, 10:10 AM
Here you go @Jack -- an example with two different mem methods to do what you're doing.
Code: (Select All)
Declare CustomType Library
Sub memcpy (ByVal dest As _Offset, ByVal source As _Offset, ByVal bytes As Long)
End Declare
Dim As _Offset os, ox, oy
Dim As Long i
Dim As Double x, y
Dim As String * 80 s
os = _Offset(s)
ox = _Offset(x)
oy = _Offset(y)
For i = 0 To 9
x = Sqr(i + 1)
memcpy os, ox, 8
os = os + 8
Next
os = _Offset(s)
For i = 0 To 9
memcpy oy, os, 8
Print y
os = os + 8
Next
Sleep
'Using _MEM commands instead
Print
Print "MEMCOPY!"
Dim As Double y1
Dim As _MEM m, m1
m = _Mem(s)
m1 = _Mem(y1)
's is already full of the data, so we don't need to recreate it. Let's just copy it to y1
For i = 0 To 9
_MemCopy m, m.OFFSET + i * 8, 8 To m1, m1.OFFSET
Print y1
Next
Sleep
Print
Print "MEMGET!"
For i = 0 To 9
Print _MemGet(m, m.OFFSET + i * 8, Double)
Next