Why can’t I static_cast between char * and unsigned char *?

They are completely different types see standard: 3.9.1 Fundamental types [basic.fundamental] 1 Objects declared as characters char) shall be large enough to store any member of the implementation’s basic character set. If a character from this set is stored in a character object, the integral value of that character object is equal to the value … Read more

cout not printing unsigned char

cout << a is printing a value which appears to be garbage to you. It is not garbage actually. It is just a non-printable ASCII character which is getting printed anyway. Note that ASCII character corresponding to 1 is non-printable. You can check whether a is printable or not using, std::isprint as: std::cout << std::isprint(a) … Read more

uint8_t can’t be printed with cout

It doesn’t really print a blank, but most probably the ASCII character with value 5, which is non-printable (or invisible). There’s a number of invisible ASCII character codes, most of them below value 32, which is the blank actually. You have to convert aa to unsigned int to output the numeric value, since ostream& operator<<(ostream&, … Read more