QString 转 const char *:std::string = QString.toStdString();const char* = std::string.data();这种方式可能会失效,换用另一种方式:std::string sFile = (const char*)strFileName.toLocal8Bit(); const char * filename = sFile.data();
其他:
char* --------------QByteArray(const char*)-----------> QByteArray
char* --------------QString(const char*)-------------->QString
QByteArray -------------data()-------------------->char*
QByteArray ------------QString()------------------->QString
QString --------------toAscii()--------------------> QByteArray
QString -------------qPrintable()------------------>char*
或QString --------toLatin1()------QByteArray----------data()--------->char*