gogoWebsite

QT int turns hexadecimal and add 0

Updated to 1 hour ago

Method 1,

QString key;
key =  QString("%1").arg(k,4,16,QLatin1Char('0'));//kforintType orcharAll types are OK
 
Method 2:
char chBuf[20];
sprintf(chBuf,"%02x",k);
key = QString::fromUtf8(chBuf);
or key = QString(QLatin1String(chBuf));
 
No need to make up0Will10Category conversion16Category string
key = QString::number(k, 16);

Qstring Convert char* Problem

QString qstr("hello,word");  

const char * p = qstr.toLocal8Bit().data(); 

const char *p = ().data();