-2

How can I conver hexdecimal string to unsigned char bytes ?

std::string = "ffddaabb";
to
unsgined char[] = "\xff\xdd\xaa\xbb";
B3mB4m
  • 15
  • 4

1 Answers1

-1

This is not an unsigned char

"\xff\xdd\xaa\xbb"

The correct type you get by assigning this literal is a const char pointer.

In order to get a single char you should do

unsigned char ch = 0x2A;
GaryO
  • 26
  • 1