[Qt-creator] To Open a File and Read It.

Keiver Hdez Fdez khfernandez at estudiantes.uci.cu
Mon Feb 2 11:09:08 CET 2009


 Already tried all the three advices, the file.error() function return value 0, QFile::NoError.
The working directory is the right one. I just checked visually on qtcreator and with qDebug().

Still with no solutions, inside qtcreator the application works fine, but by clicking the executable this does not work.

----- "Sarah Hollings" <sarah.hollings at gmail.com> wrote:

| Assuming you're running qtcreator and the terminal as the same user,
| things to try:
| 
| * Check the run settings on the project tab to see what the working
| directory is.
| * Use file.error() to see what the error condition is (look up the
| value of the enum here:
| http://doc.trolltech.com/4.4/qfile.html#FileError-enum)
| * Add some debug:
|    qDebug() << "Current working dir:" << QDir::currentPath()
| (You'll need to add #include <QDebug> and <QDir>)
| 
| 
| On Mon, Feb 2, 2009 at 6:40 PM, Keiver Hdez Fdez
| <khfernandez at estudiantes.uci.cu> wrote:
| >
| > Hi there;
| >
| > I'm using Qt Creator in a small application and I need to open a
| file and read it. The thing is that I have this code:
| >
| > QFile file("config/exclude_files.exc");
| >
| > if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
| > {
| >  ...
| > }
| >
| > If I execute the application by clicking, it does not work and if I
| executed in a terminal it works fine.
| >
| > Any clues?
| >
| > Using:
| > Qt Creator 0.9.2
| > Based on Qt 4.5.0
| >
| > Built on Jan 27 2009 at 03:49:58
| > OS: Debian GNU/Linux
| > _______________________________________________
| > Qt-creator mailing list
| > Qt-creator at trolltech.com
| > http://lists.trolltech.com/mailman/listinfo/qt-creator
| >
| _______________________________________________
| Qt-creator mailing list
| Qt-creator at trolltech.com
| http://lists.trolltech.com/mailman/listinfo/qt-creator



More information about the Qt-creator-old mailing list