std::string转const char*:
std::string text;
text = ui->lineEdit->text().toStdString();//QLineEdit输入
const char* c_s = text.c_str();
const char*转string
直接赋值即可
const char* c_s = “abc”;
string s(c_s)
Qt中QString转const char*:
QString qstr = "hello Qt";
const char *pcs = qstr.toStdString().data(); // 简单快捷
const char *pcq = qstr.toLatin1().data(); // 会出问题,不稳定