[Qt-interest] QFile SetFileName on windows 7

Gopalakrishna Bhat gopalakbhat at gmail.com
Mon Apr 4 12:22:52 CEST 2011


  Hi All,

I'm trying to open a file and read it in Windows 7. I get a weird problem,
whenever I set the filename the backslashes are converted into forward
slashes. What is the reason for this? Am I doing something wrong?

The code snippet is below:
    QFile file;

    file.setFileName("C:\\development\\htmldict\\wb1913_.html");

    if(file.exists(file.fileName())) {

        file.open(QIODevice::ReadOnly);

        qDebug()<<file.readAll();

    }

    else

        qDebug()<<"no such file"<<file.fileName();



The output I get is


no such file "C:/development/htmldict/wb1913_.html"

With regards,
Gopalakrishna

-- 
My blog http://gkbhat.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110404/47b39a5d/attachment.html 


More information about the Qt-interest-old mailing list