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.
精彩评论