PDA

View Full Version : file handling



santakdalai90
22nd October 2009, 21:18
Can anyone please explain file handling in Qt?
Please specify how a file is created. I was earlier using c++, so please give an equivalent Qt code for the following.


#include <fstream>

int main()
{
ofstream file("file1.txt");
string s = "how are you?";
file << s;
}

the problem is that ofstream creates a file if it doesn't exist. But Qfile does not.

wysota
22nd October 2009, 21:50
But Qfile does not.

Sure it does. Did you actually try to open the file?