Page 1 of 1

Structures

Posted: Tue Jul 29, 2003 9:20 am
by AngelSoul
Hi,

I'm new to PureBasic and i'm trying to see it's possible to copy an index to another of a structure.

Structure misc1
NetId.l
Buffer.s
IP.s
Steps.b
EndStructure
Dim Client.misc1(20)

Lets say i want to copy index #1 of Client to Index #2.

In Visual Basic you can do Client(2)=Client(1) but it doesn't work in PB :>

Is it possible or I would have to copy every elements from an index to another?

Thanks

Posted: Tue Jul 29, 2003 12:26 pm
by Pupil
Sorry, but for now you'll have to copy each element separately, but if you have a structure without any strings in it you could do it like this:

Code: Select all

...
Dim Client.MyStruct(20)
...
CopyMemory(@Client(#Index1), @Client(#Index2), SizeOf(MyStruct))
; this will copy the content of #index1 to #Index2