Code is working, but is it failsafe?
Hi everyone!
I've always got some difficulties when I try to work with pointers, arrays, etc.
This time even the SPIN examples in the Propeller manual couldn't help me anymore.
The following code is working, but I'm not sure if it is allowed the way I did it.
Are these last three lines legal operations?
I've always got some difficulties when I try to work with pointers, arrays, etc.
This time even the SPIN examples in the Propeller manual couldn't help me anymore.
The following code is working, but I'm not sure if it is allowed the way I did it.
Are these last three lines legal operations?
VAR
word index, port
long ipaddr, uri
DAT
station1 byte 213, 251, 166, 36
word 8050
byte "/",0 'CineMix
station2 byte 94, 23, 193, 30
word 80
byte "/",0 '1onAir Maxxhits
stations long @station1, @station2
PUB Main
index:=0 ' station1 selected
ipaddr:=@byte[noparse][[/noparse]@@stations[noparse][[/noparse]index]] ' pointer to the ip address of the selected station
port:=word[noparse][[/noparse]@@stations[noparse][[/noparse]index]+4] ' port of the selected station (value)
uri:=@byte[noparse][[/noparse]@@stations[noparse][[/noparse]index]+6] ' pointer to the uri of the selected station

Comments
give me the address of the first byte of a byte array starting at given address, which means that the part inside of the square brackets is already the address you want.
'Sorry, couldn't resist!
-Phil
@Phil: Nice picture