Hello,
I'm trying to output some text into a new file but the file.open call always returns false.
file.write(ui.label->toPlainText().toUtf8());
file.close();
}
QFile file("test.txt");
if(file.open(QIODevice::ReadOnly | QIODevice::Text)){
file.write(ui.label->toPlainText().toUtf8());
file.close();
}
To copy to clipboard, switch view to plain text mode
I found the following in the documentation of QFile's open function:
Note: In WriteOnly or ReadWrite mode, if the relevant file does not already exist, this function will try to create a new file before opening it.
So I thought it may have something to do with the permissions, and I tried :
file.
setPermissions(QFile::WriteOwner);
file.setPermissions(QFile::WriteOwner);
To copy to clipboard, switch view to plain text mode
But it returns false as well.
Any idea about how I can create the file ?
My environment :
Qt 4.6.2
Carbide.c++ 2.3.0
S60 5th Edition SDK v1.0
winscw emulator
Bookmarks