Excuse me for my english. I have a number of int values stored in it from 0 to 255. To find out what lies in 7 bit number, I translate the numbers into a binary system, then in the line and check the line:
if (informationOctet_.substr(6, 1) == "0") { ... } Two questions arose,
If I use int (which we have 4 bytes), and my number is unsigned int the range [0, 255] How do I determine which byte I need to consider? High byte?
I have found the desired byte, how do you know the contents of, for example, the 6th bit?
P.S. I do not use spells, because do with unsigned int.
THANK ALL, I test int number:
int k = 3; for (int i = 0; i < 8; i++) { if (k & (1 << i)) { std::cout << 1; } else { std::cout << 0; } } print: 11000000