[英]How to check if a hex number is equal to a specific binary number?
Hi I'm trying to do something which should be simple, but I can't figure it out. 嗨,我正在尝试做一些应该很简单的事情,但我无法弄清楚。 I have a pointer to an array of unsigned chars, and I get the first element, which is a hex number.
我有一个指向无符号字符数组的指针,我得到了第一个元素,它是一个十六进制数字。 I want to convert it to binary so I can check if it's equal to a number such as 0x01101000.
我想将其转换为二进制,以便检查是否等于数字,例如0x01101000。
unsigned char arr[] = {0x25}; //just for example. I am actually using *arr.
unsigned char byte = arr[0];
if(( byte & 0x01101000) == //not sure if this is the right way to proceed
Would appreciate some help! 希望能有所帮助! Thanks!!
谢谢!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.