您当前的位置: 首页 >  c++

令狐掌门

暂无认证

  • 0浏览

    0关注

    513博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

C++ Qt QString转string乱码的处理方法

令狐掌门 发布时间:2021-12-16 21:55:53 ,浏览量:0

QString在转string时,如果有中文,会出现乱码,如果是文件名,那么读文件时就会出现空指针现象,还是要多注意。

例如下面的代码

#include 
#include 
#include 
#include 

using namespace std;

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QString qstr1 = "D:/测试视频/笑傲江湖第1集.mp412345A";
    std::string str1 = qstr1.toStdString();
    qDebug()             
关注
打赏
1652240117
查看更多评论
0.0399s