Qt帮助文档中给的一个demo
QString tmp = "test"; QByteArray text = tmp.toLocal8Bit(); char * pCh = new char[text.size()+1]; strcpy(pCh, text.data());
delete [] data;
别的文章中也给出了一些方法
char *chStr = NULL; QByteArray ba = str.toLatin1(); chStr = (char *)malloc(ba.length() + 1); memset(chStr, 0, ba.length()); memcpy(chStr, ba.data(), ba.length()); chStr[ba.length()] = '