String Query
Posted: Thu Jan 05, 2012 11:39 pm
Hi
Im having a problem with something im working on using strings.
Basically what im doing is receiving data using the RXINT, each character received is being put into an array. The upon receiving <CR> the string is processed.
So i have a string variable set like this STRING[20]
After processing the string i fill the array with 255 values (i think that makes it blank ????)
To process the string its a case of finding out what was sent, so lets say i send "SEND TEMP" Thats 9 characters out of 20.
I have another string called SEND_TEMP[9] which = "SEND TEMP"
Now heres where im a bit stumped, i try to compare these strings to see if what was received matches any of the commands, so i compare STRING, and SEND_TEMP but they dont show as a match.
The only way they show as a match is is STRING[20] is changed to STRING[9] in the variables list. As you can imagine this sort of limits the about of characters i can now receive, especially since one of the commands is "STCH" thus potentially limiting me down to 4 character arrays.
Is there something i am doing wrong here or is this just how it is?
Im having a problem with something im working on using strings.
Basically what im doing is receiving data using the RXINT, each character received is being put into an array. The upon receiving <CR> the string is processed.
So i have a string variable set like this STRING[20]
After processing the string i fill the array with 255 values (i think that makes it blank ????)
To process the string its a case of finding out what was sent, so lets say i send "SEND TEMP" Thats 9 characters out of 20.
I have another string called SEND_TEMP[9] which = "SEND TEMP"
Now heres where im a bit stumped, i try to compare these strings to see if what was received matches any of the commands, so i compare STRING, and SEND_TEMP but they dont show as a match.
The only way they show as a match is is STRING[20] is changed to STRING[9] in the variables list. As you can imagine this sort of limits the about of characters i can now receive, especially since one of the commands is "STCH" thus potentially limiting me down to 4 character arrays.
Is there something i am doing wrong here or is this just how it is?