demand
Since using QT to write network-related interfaces, you need to customize the data structure, you need to call the char[] array variable during parsing, and you need to convert between QString and QByteArray
QByteArray转char[]
QByteArrya *qbyte = new QByteArray("hello world");
char cstr[20] = [];
//strcpy
strcpy(cstr,qbyte->data());
QString to char[]
- Convert by QByteArray
QString *qstr = new QString("hello world");
char cstr[20] = [];
strcpy(cstr,qstr->toLatin1().data());
- Convert through C++ stdstring
QString *qstr = new QString("hello world");
char cstr[20] = [];
strcpy(cstr,qstr->toStdString().data());