简体   繁体   中英

Encoding of filepath in qt

I am writing method, which reads the WAV file. When i use it with filepath like a "E:\\wavfile.wav", it works fine. But path can contain with russian symbols (cp1251):

void WAV::open(QString path)
{
    qDebug() << path; // in console displayed valid path

    FILE *pFile = fopen(path.toStdString().c_str(),"rb"); // but there is an error 

path looks like this:

How i can fix this? (I use QT)

听起来好像您正在寻找fromPercentEncodingtoEncoded

void WAV::open(QString path)
{     
     FILE *pFile = fopen(path.toLocal8Bit(),"rb");

I just used method . 方法。 And it works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM