编码:
QTextCodec code = QTextCodec::codecForName(“GB2312”);//解决中文路径问题
_pathName=savePath+’/’+QString::number(_ChannelID+1)+“通道”+f(_realStartTime)+“至”+f(_realEndTime);
std::string strSavePath= code->fromUnicode((_pathName+".dav")).data(); //= code->fromUnicode((savePath+’/’+QString::number(ChannelID+1)+’’+f(realStartTime)+"__"+f(realEndTime)+".dav")).data();
char filePath2 = const_cast<char *>(strSavePath.c_str());
解码:
QTextCodec *code = QTextCodec::codecForName(“GB2312”);
QTextDecoder dcode(code);
filePath =dcode.toUnicode(filePath.toStdString().c_str(),sizeof(filePath.toStdString()));//解决中文路径问题
qt中文路径的编码和解码
最新推荐文章于 2024-07-12 13:48:22 发布