qt ofstream 中文路径

    QString path("C:\\测试.txt");
    ofstream o_file;
    #ifdef Q_OS_WIN32
       o_file.open((wchar_t*)path.utf16(),ios::trunc);
    #endif
    o_file << "test" << endl;
    o_file.close();

ofstream open的时候,带有中文字就挂了,上面是解决方案,好像只能在win32中有效。

1231

Leave a Reply

Name and Email Address are required fields.
Your email will not be published or shared with third parties.