In case you want the numerical values in the string, see QString::toInt(), using a base of 16
Cheers,
_
In case you want the numerical values in the string, see QString::toInt(), using a base of 16
Cheers,
_
schunyeh (28th January 2015)
Read about QByteArray::fromHex
schunyeh (28th January 2015)
Thank jthomps,anda_skoa,Lesiok for the reply.
The case is that I would like to input a text file that has a decimal number, and then got the numer to change them to the hexadecimal format ( 0xff), & write them to a special binary file format ( 008a 001a .... ..... ).
After trying to convert, I have found the following API can do it.
Thank you for the help.QString test_number; // "0x8a"
QByteArray test_hex;
test_hex = QByteArray::fromHex( test_number.toLocal8Bit().constData() );
qDebug()<<test_hex.at(1); // 0x8a
Bookmarks