Structures

Everything else that doesn't fall into one of the other PB categories.
AngelSoul
User
User
Posts: 55
Joined: Tue Jul 29, 2003 9:16 am
Location: Canada

Structures

Post 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
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post 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
Post Reply