Keil Logo

GENERAL: WRONG RESULT IN STRING ESCAPE SEQUENCES


Information in this article applies to:

  • C51 All Versions
  • C166 All Versions
  • C251 All Versions
  • CARM All Versions

QUESTION

In my C source code I am using special characters in strings.

For example:

string1[ ] = "Fran\x07ais\0"

I expected that this would result in the word Français. However, it appears that the Compiler uses 0x7A since the result is just Franzis.

Is this a known bug?

ANSWER

This is a standard ANSI behaviour. To get what you expect you need to break strings at the Escape Sequences. The expected result is generated when you write:

string1[ ] = "Fran" "\x07" "ais\0"

MORE INFORMATION

  • ANSI Standard Specification

SEE ALSO

Last Reviewed: Monday, December 13, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.