PDA

View Full Version : conversion between string to hex and vice versa



mohanakrishnan
5th December 2009, 09:39
hi
i am having a string like,
QString str="01deff";
and i want to convert into hex like ,
char val[3];
val[0]=0x01;
val[1]=0xde;
val[2]=0xff;

and i need the vice versa,ie
char val[3];
val[0]=0x01;
val[1]=0xde;
val[2]=0xff;

to
QString str="01deff";
pls can any one help me?
thanks
:confused::confused:

Lykurg
5th December 2009, 10:30
QString, QStringList and QString::left(), QString::mid(), QString::right() and QByteArray::toHex(), QByteArray::fromHex()... choose whatever you want...

mohanakrishnan
5th December 2009, 11:25
hi Lykurg
i ll try and with ur ideas and come back
thanks...:)