Jump to content

SB 7.30 Funny String Handling with \xFF...

Recommended Posts

I have a routine like:

EEPROMwrite(unsigned char addr, unsigned char* str, unsigned char len)


// print out hex of string of length "len"...


I call it using hex replacement values in a string, ie using the "\xnn" replacement method:

EEPROMwrite(,addr, "\xFF\x00\x01",3);     (prints 00 00 01)

Now, if a "\x" replacement in the string contains FF (or ff) , the hex value read \ printed is 00 ..

BUT if the value is preceded by another value (which is not 00 or FF), eg,

EEPROMwrite(,addr, "\01\xFF\x00",3);     (prints 01 FF 00)

... it correctly reads \ prints the hex value as FF!

To be clear, 

EEPROMwrite(,addr, "\00\xFF\x00",3);     (prints 00 00 00)

... does NOT print out FF, as the preceding value is 00..


I have checked the web and this does not seem to be expected behaviour - can you look into it please?

Share this post

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...