I\'m noticing that cout << hex is giving me strange results, and I cannot find anywhere that answers why. What I am doing is simply assigning some values to
uint8_t is an alias for unsigned char. You're essentially printing a character with the value 0xab, which might be an invalid character depending on your encoding.
This would be solvable by casting it to another integer type, converting its value to a string in advance or writing some sort of a wrapper class that implements std::ostream& operator<<(std::ostream&, const ClassName&).