J
Jim Langston
I want to build a string that contains the character 1, followed by ABC
followed by the characters 255 255. One would think it would be simple:
std::string Data( "\x01ABC\xFF\xFF", 6);
but that doesn't compile. It says:
error C2022: '6844' : too big for character
At first I wondered where the heck it got 6844 then I realized. It took the
excape sequence as \x01ABC since A, B and C are valid hexidecimal digits.
So I tried
std::string Data( "\x0001ABC\xFF\xFF" );
but same error. How do I get the compiler to stop treating characters as
hex digits but part of the data? I know I could break up the string
something like:
std::string Data("\x01", 1 );
Data += "ABC\xFF\xFF";
but that seems like an extra step I really don't need (or do I)?
followed by the characters 255 255. One would think it would be simple:
std::string Data( "\x01ABC\xFF\xFF", 6);
but that doesn't compile. It says:
error C2022: '6844' : too big for character
At first I wondered where the heck it got 6844 then I realized. It took the
excape sequence as \x01ABC since A, B and C are valid hexidecimal digits.
So I tried
std::string Data( "\x0001ABC\xFF\xFF" );
but same error. How do I get the compiler to stop treating characters as
hex digits but part of the data? I know I could break up the string
something like:
std::string Data("\x01", 1 );
Data += "ABC\xFF\xFF";
but that seems like an extra step I really don't need (or do I)?