How to place an array of structures in a memoryblock

Here’s the situation:
There is a structure containing several variables called: mystructure.
I have an array of these:
var mystructurearray(1000) as mystructure
I have a memory block:
var mymemoryblock as memoryblock (1000 * mystructure.size)

Now, how do I tell Xojo to place mystructurearray in mymemoryblock?

It probably requires a Ptr, but what exactly? Thanks

Use Ptr.STRUCTURENAME(OFFSET)

Untested forum code:

var mymemoryblock as memoryblock (1000 * mystructure.size)
var p As Ptr = mymemoryblock
var offset As Integer = INDEXOFSTRUCT * mystructure.size
p.mystructure(offset) = ACTUALSTRUCT

Thanks Andrew - that works! Thanks!

var ACTUALSTRUCT as mystructure
var mymemoryblock as new memoryblock (1000 * .mystructure.size)
var p As Ptr = mymemoryblock
var INDEXOFSTRUCT as integer = 345 ’ a test value
var offset As Integer = INDEXOFSTRUCT * mystructure.size
p.mystructure(offset) = ACTUALSTRUCT ’ copies to memoryblock
ACTUALSTRUCT = p.mystructure(offset) ’ copies to ACTUALSTRUCT