Shop OBEX P1 Docs P2 Docs Learn Events
Pointers — Parallax Forums

Pointers

TwimTwim Posts: 10
edited 2007-07-19 22:55 in Propeller 1
Help
I would like to create a pointer that references the first element in a byte array (byte[noparse][[/noparse]0])
however I can’t quite figure out how it’s done in Spin.
The array and pointer are declared in the Var block of the spin program. The program works as expected
whenever the routine is called using method 1 but does not when called using method 2.
I have tried Several variations of method 2 without success.
any help on this matter is greatly appreciated.

Var
·byte TextBoxBuffer[noparse][[/noparse]6]
·long pointer_to_TextBoxBuffer

··
(Method 1)·· getKeyboardInput( @TextBoxBuffer[noparse][[/noparse]0] , TextBoxFieldsize )
·····

(Method 2)·· pointer_to_TextBoxBuffer:= @TextBoxBuffer[noparse][[/noparse]0]···················
············ getKeyboardInput( pointer_to_TextBoxBuffer , TextBoxFieldsize

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-19 22:40
    I don't see why there would be any difference between the two methods. There must be something else different that's not show in your code fragments. Just for your information, you don't need the "[noparse][[/noparse] 0 ]" since the address of the array is that of the first element which is always element zero.
  • TwimTwim Posts: 10
    edited 2007-07-19 22:55
    Thanks Mike
    Ill take another look.
Sign In or Register to comment.