一、QString str;
char *ch;
QByteArray ba = str.toLatin1();
ch = ba.data();
二、将QString转换为标准库string类型,然后将string转为char *
QString name;
std::string cstr = name.toStdString();
consr char *ch = str.c_str();
时间: 2024-10-10 10:53:51
一、QString str;
char *ch;
QByteArray ba = str.toLatin1();
ch = ba.data();
二、将QString转换为标准库string类型,然后将string转为char *
QString name;
std::string cstr = name.toStdString();
consr char *ch = str.c_str();