Qt中QString和char *的转换

在Qt中QString和char *之间不能直接转换,要想将其中一个的数据内容赋给另外一个,需要使用QByteArray中转,例子如下:

    QByteArray SysCmd_getUpdateFileNameQByteArray = "ls /opt/GunManage/download/GunManageV";
    SysCmd_getUpdateFileNameQByteArray += AreaCode.toAscii();
    SysCmd_getUpdateFileNameQByteArray += "*";
    char *SysCmd_getUpdateFileName = new char[SysCmd_getUpdateFileNameQByteArray.length()];
    SysCmd_getUpdateFileName = SysCmd_getUpdateFileNameQByteArray.data();


你可能感兴趣的:(C++,Linux,QT,Qt5)