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?
String Query
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: String Query
Hi cobra1,
I used a different method than Compare string function for 232 comms.
Maybe this may help?
http://www.matrixmultimedia.com/mmforum ... 877#p21243
Martin
I used a different method than Compare string function for 232 comms.
Maybe this may help?
http://www.matrixmultimedia.com/mmforum ... 877#p21243
Martin
Martin
- Steve
- Matrix Staff
- Posts: 3429
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: String Query
Try filling with zeros, or at least setting the final (i.e. 10th) character of the STRING variable to zero.cobra1 wrote:After processing the string i fill the array with 255 values (i think that makes it blank ????)
- Steve
- Matrix Staff
- Posts: 3429
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: String Query
If I understand correctly, the CR character signifies the end of the string when you send it. In this case, Flowcode should add the NULL character to the end of the string when the CR is received.