开发者

A problem with openning the file

Hi I want to open the file that is in a place in my computer . I use this code but it doesn't open it . How can I open that file ?

QString path = "C:\Program Files (x86)\vnb.txt" ;
QFile inFile( path );
if (!in开发者_如何学编程File.open(QIODevice::ReadOnly | QIODevice::Text))
return -1 ;


Never use \ as the file separator in QT. Always use / and QT will make sure that it is always portable. This is clearly stated in the documentation of QFile.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜