Hi Everyone,
Can anyone tell me how to delete a file in Qt. I have tried QFile::remove and QDir::remove. But none of them are working as my expectation. Any help will be appreciated.
Thanks.
Hi Everyone,
Can anyone tell me how to delete a file in Qt. I have tried QFile::remove and QDir::remove. But none of them are working as my expectation. Any help will be appreciated.
Thanks.
For me they work perfect. What do you expect and are you sure you set the right file, which you want delete?
I have created one database and place it into c:\oxscan\dbFile.db. Now I want to either delete it or clear the contents of it. So I have used the following code;
QFile File("C:\\Oxscan\\dbFile.DB");
bool bRemoved = File.remove();
... and the after that bRemoved is true or false?
If false, the file is probably in use, so windows does not permit to delete it.
bRemoved is false. So if I call File.close(), will it work.
Thanks for your help. Now it is not required to delete the file. I have just deleted the contents and working as my expectation.
Bookmarks