成功实现QString与CString互转

QString qstrSrc = ui.m_pLineEditIn->text(); string str = qstrSrc.toLocal8Bit().data(); CString strTmp = str.c_str(); char* pcTmp = new char(strTmp.GetLength()); wsprintfA(pcTmp, "%S", strTmp.GetBuffer(strTmp.GetLength())); QString qstr(QString::fromLocal8Bit(pcTmp)); ui.m_plineEditOut->setText(qstr);

你可能感兴趣的:(String)