I have a data packet from a modem that contains a zero terminated phone number and then the message after this, also zero byte terminated.
How can I get a pointer to the second part of the array after working out where the zero terminator on the phone number was?
//
// Get the phone number who sent us the SMS
//
XbeeMessage = new string(Encoding.UTF8.GetChars(response.Value));
//
// We need to find the null in the bytes and then extract the message
// from this
//
int index = 0;
while(response.Value[index] != 0)
{
index++;
}
index++; // Jump past the zero
XbeeMessage = new string(Encoding.UTF8.GetChars(response.Value[index]));
The last line here gives an error of course. So how to do this?