OiO.lk English C++ How to properly add hex escapes into a string-literal?
C++

How to properly add hex escapes into a string-literal?


I have trouble how to proper convert encoded hex number in string.
I find where problem lies but don’t know how to solve it.

So simple C defines like this:

const char xxx[]={"Test\x33Value"};
const char yyy[]={"Test\x33Continue"};

The 1st const is parsed sucesfuly as \x33 is proper understood (After /x33 is letter V which is not hex value). The 2nd const is failed with

warning: hex escape sequence out of range

as value is treated as \c33C! as next letter after /x33 is C which IS hex char. I have all escaped values stored as 2 chars. So how to force that all values are treated as two chars after \x.



You need to sign in to view this answers

Exit mobile version