Jump to content
Sign in to follow this  
DTPIC

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" replecement method:

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

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);

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

To be clear, 

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

... 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

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
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.

Loading...
Sign in to follow this  

×