Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_mem
#5
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
Reply


Messages In This Thread
_mem - by Jack - 12-31-2024, 09:52 PM
RE: _mem - by DSMan195276 - 01-01-2025, 07:11 AM
RE: _mem - by Jack - 01-01-2025, 09:08 AM
RE: _mem - by Jack - 01-01-2025, 10:01 AM
RE: _mem - by SMcNeill - 01-01-2025, 10:18 AM
RE: _mem - by SMcNeill - 01-01-2025, 10:10 AM
RE: _mem - by Jack - 01-01-2025, 10:27 AM
RE: _mem - by SMcNeill - 01-01-2025, 10:36 AM
RE: _mem - by Jack - 01-01-2025, 10:40 AM
RE: _mem - by SMcNeill - 01-01-2025, 10:45 AM
RE: _mem - by Kernelpanic - 01-01-2025, 11:55 PM
RE: _mem - by DSMan195276 - 01-01-2025, 11:13 PM
RE: _mem - by DSMan195276 - 01-02-2025, 12:27 AM



Users browsing this thread: 8 Guest(s)