2013-12-03 52 views
0

我正在编写读取WAV文件的方法。当我使用它的文件路径像“E:\ wavfile.wav”,它工作正常。但路径可以包含与俄罗斯的符号(CP1251):
“E:/ Google云端硬盘/谷歌Диск/РАБОТА/ IP-PHONE/vaneev/guncanns.wav”
qt中的文件路径编码

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 

路径如下像这样:
E:/ Google云端硬盘/谷歌Диск/РРђР'РћРўРђ/ IP-PHONE/vaneev/guncanns.wav

我该如何解决这个问题? (我用QT)

回答

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

我只是使用的方法toLocal8Bit()。它的工作原理!