if (32 == buf*) {[/quote] What???* [/quote] 32 always means a blank space. So, when I transmit "-21 -43 -23" the spaces are received as an int 32. I am using VirtualWire to send/receive and buf/buf len are created like this: * *uint8_t buf[VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN; vw_get_message(buf, &buflen);* *
No I meant is, why do that and not use strtok() to split the data? Your not going to be able to sift out the negative numbers so easily, because your looking for ints, but it is possible.
HazardsMind:
No I meant is, why do that and not use strtok() to split the data? Your not going to be able to sift out the negative numbers so easily, because your looking for ints, but it is possible.
Ah, I am new to the C languages and didn't know strtok() existed.
Is there no way to just transmit the char array and receive it as a char array?
Edit: How would I turn the buf into a char array so I could use strtok()?
Is there no way to just transmit the char array and receive it as a char array?
Of course there is. But, you only showed code for one end.
Have you had a peak at an ASCII table? "-34 -32 -44" is 45, 51, 52, 32, 45, 51, 49, 32, 45, 52, 52 if you print the bytes as bytes instead of as chars. You seem to be handling the 32's OK.
PaulS:
Of course there is. But, you only showed code for one end.
Have you had a peak at an ASCII table? "-34 -32 -44" is 45, 51, 52, 32, 45, 51, 49, 32, 45, 52, 52 if you print the bytes as bytes instead of as chars. You seem to be handling the 32's OK.
Ah, that is exactly what I was looking for and it now makes perfect sense. Thanks!