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

sprintf conversion problems

Why does sprintf generate a Null when sprinting extended character 253(decimal) in to a a string variable?

i.e.


sprintf(s,"%s","ý");


If I then look at s in debug the first location is NULL.

All other extended characters appear fine!

Parents
  • Thanks for the suggestion.

    Only problem is, I use the extended characters for "special" symbols (button shapes etc.) on an LCD and these could be part of a full text string. This is the reason I used the %s format rather than %c.

    e.g. "1234ý678"
    the result data string would be:
    31,32,33,34,36,37,38

    I used sprintf in my example, but it was passing the string as a parameter to a function that brought the problem out. It was coincidence that sprintf resulted in the same problem.

    As stated in my original thread, all the other extended characters work! Why is 253 so different?

    Steve

Reply
  • Thanks for the suggestion.

    Only problem is, I use the extended characters for "special" symbols (button shapes etc.) on an LCD and these could be part of a full text string. This is the reason I used the %s format rather than %c.

    e.g. "1234ý678"
    the result data string would be:
    31,32,33,34,36,37,38

    I used sprintf in my example, but it was passing the string as a parameter to a function that brought the problem out. It was coincidence that sprintf resulted in the same problem.

    As stated in my original thread, all the other extended characters work! Why is 253 so different?

    Steve

Children