Tadas

23rd July 2011, 14:05

Hi,

how to get 5 as int from number=QByteArray::fromHex("05");

or how to add 30 as hex to hex value 05, becouse

QByteArray::fromHex("35").toInt(); will give me int as 5

another question

QByteArray number2;

int nubint=3345;

number2= QByteArray::number(nubint).length();

qDebug()<<"number2"<<number2.toHex();

why do I get number2 in hex as 04 in hex, but not as 34 ;

and why i get error message if I will edit 3 line like this number2= QByteArray::number(nubint).length();

error: invalid conversion from 'int' to 'const char*'

error: initializing argument 1 of 'QByteArray& QByteArray::operator=(const char*)'

i'm totally messed up with bits and bytes..

how to get 5 as int from number=QByteArray::fromHex("05");

or how to add 30 as hex to hex value 05, becouse

QByteArray::fromHex("35").toInt(); will give me int as 5

another question

QByteArray number2;

int nubint=3345;

number2= QByteArray::number(nubint).length();

qDebug()<<"number2"<<number2.toHex();

why do I get number2 in hex as 04 in hex, but not as 34 ;

and why i get error message if I will edit 3 line like this number2= QByteArray::number(nubint).length();

error: invalid conversion from 'int' to 'const char*'

error: initializing argument 1 of 'QByteArray& QByteArray::operator=(const char*)'

i'm totally messed up with bits and bytes..