Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Complete conversion from hexadecimal to binary

$
0
0
Hello, everyone! I am reading bytes from serial port and I need to get one of these bytes and convert it from hexadecimal to binary. I got it, but I want to show the 8 bits from the byte, because I will work with them in the future. In the code below, I can show the bytes in binary, but I can’t show the zeros in the left size to complete 8 bits. I need it because I want to extract each bit from this byte to work after that. int flag_one  =   REGISTRO1.toInt(&ok,16);   // Informações do elevado QString flag_converted   = QString::number(flag_one,2);

Viewing all articles
Browse latest Browse all 13965

Trending Articles