本文介绍了uint8显示奇怪的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经声明了一个uint8变量,当它的值被打印时,我得到笑脸和空格。 c>
a typedef 为 unsigned char 。然后 std :: cout<< u 将打印符号而不是整数值,其中 u 的类型为 uint8 。
Try
std :: cout< static_cast< int>(u);
或
std :: cout<< + u;
打印数字值。
I've declared a uint8 variable and when the value in it is printed, I get smiley faces and white spaces. Shouldn't it display integer values?
解决方案
I bet uint8 is a typedef for unsigned char in your system headers. Then std::cout << u will print symbols rather than integer values, where u is of type uint8.Try
std::cout << static_cast< int >( u );
or
std::cout << +u;
to have numeric values printed.
这篇关于uint8显示奇怪的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!