Static arrays in nested structures

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Max..

I'm having a hard time figuring that out. Guess the fault is inbetween my ears...

Code: Select all

;[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/gettcptable.asp[/url]

Structure MIB_TCPROW
  dwState.l
  dwLocalAddr.l
  dwLocalPort.l
  dwRemoteAddr.l
  dwRemotePort.l
EndStructure

Structure MIB_TCPTABLE
  dwNumEntries.l
  TCPROW.MIB_TCPROW(100)
EndStructure

Global pwdSize, TCPTABLE.MIB_TCPTABLE

;call 1st to set buffer size
Debug "1st call: "+Str(GetTcpTable_ (@TCPTABLE,@pwdSize,1))

;get buffer size
Debug "pwdSize "+Str(pwdSize)

;get tcp table
Debug "2nd call: "+Str(getTcpTable_ (@TCPTABLE,@pwdSize,1))

;output data from TCPTABLE
Debug "dwNumEntries "+Str(TCPTABLE\dwNumEntries)

;dwRemotePort = TCPTABLE\TCPROW(0)\dwRemotePort
;dwRemotePort = TCPTABLE.MIB_TCPTABLE\TCPROW(0)\dwRemotePort
I tried several varieties of the last 2 lines in the code, but neither
works (the compiler complains about a "Syntax Error"). As you can see,
I did try to adapt fred's small snippet:

Code: Select all

Structure Wheel
radius.l
texture.l
EndStructure

Structure Bike
Front.Wheel
Rear.Wheel
EndStructure

RedBike.Bike\Front\radius = 100
RedBike\Rear\radius = 50
What works is to retrieve the values using PeekL and setting
the offsets manually.

Thanks.


Max.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pupil.

Use square brackets instead of parantheses, i.e. '[]' instead of '()' and you'll get rid of the error message..
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Max..

*sigh* Gracias. :)

Max.
Post Reply