Shop OBEX P1 Docs P2 Docs Learn Events
Storing string pointer to an array — Parallax Forums

Storing string pointer to an array

jdshoejdshoe Posts: 7
edited 2012-01-25 15:40 in Propeller 1
Hello,
Hopefully an easy question.

I'm assigning the following vars
byte listarray[64]
byte StringList[50]

Then running the following method, using BS2_Functions object.
BS2.Serin_Wait(1,@listarray," ",9600,1,8)

How can I take the value of @listarray and store it to StringList[1] array element. I would use this in a loop, so 1 would really be "x', a loop counter.

Thanks!

-Justin

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-01-25 15:40
    You can't because StringList is an array of bytes and address are at least two bytes long. You could store the address as two bytes. Easiest would be to declare StringList as an array of words. Remember that most strings are longer than a single byte. You'll have to give more information if you need more suggestions.

    If you declared: word StringList[ 50 ]

    You'd store the address like: StringList[ 0 ] := @listarray
Sign In or Register to comment.