[Qt] QString 和 char* 轉換

(1) QString 轉 char*code

char acResult[10240];
//QByteArray baResult = strResult.toLatin1();
QByteArray baResult = strResult.toLocal8Bit();
char *pcResult = baResult.data();
strcpy(acResult, pcResult);

(2) char* 轉QStringit

char acName[] = "huang";
QString strName = QString(QLatin1String(acName));
QString strName = QString::fromUtf8(acName);
相關文章
相關標籤/搜索