This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sending msg

Hi guys I read the topics about interfacing 8051 with gsm modem those are really helpful However when I implemented my program to receive a msg and give an acknowledgment(through sms) for same There went something wrong : While sending my sms modem doesn't send 1st 8 characters of my msg i.e. Consider example:

unsigned char *msg = "abcdefghijklmnop"

then my msg sending routine tend to send ijklmnop thats all can anybody help Thank you

Parents
  • There is (almost) always a hidden zero at the end of C strings.

    So you can just check if str[i] == 0 to detect when you have reached the end.

    The only exception where a string does not contain the zero, is if you assign the string to an array that just has room for the characters but no termination, i.e.

    char buf[] = "hello"; // 5 characters + termination
    char buf[6] = "hello"; // 5 characters + termination
    char buf[5] = "hello"; // 5 characters but no room for termination
    

Reply
  • There is (almost) always a hidden zero at the end of C strings.

    So you can just check if str[i] == 0 to detect when you have reached the end.

    The only exception where a string does not contain the zero, is if you assign the string to an array that just has room for the characters but no termination, i.e.

    char buf[] = "hello"; // 5 characters + termination
    char buf[6] = "hello"; // 5 characters + termination
    char buf[5] = "hello"; // 5 characters but no room for termination
    

Children