How would I create a file with Qt? I know how to open an existing file with Qt using QFile::open(), but how would I actually create a file? QFile::open() doesn't seem to create files (when I'm opening them in QIODevice::ReadWrite mode).
How would I create a file with Qt? I know how to open an existing file with Qt using QFile::open(), but how would I actually create a file? QFile::open() doesn't seem to create files (when I'm opening them in QIODevice::ReadWrite mode).
Last edited by wysota; 28th January 2008 at 10:21. Reason: reformatted to look better
By the use of this you can create a file. As well as bool exists () const checks file exists or not.
Take a look of http://doc.trolltech.com/4.3/qfile.html .
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
It does:
Qt Code:
file.write( "qq"); file.close();To copy to clipboard, switch view to plain text mode
I just run the above code, and it worked. Maybe you have permission problems? Did you check file.error() ?
Bookmarks