PDA

View Full Version : how to delete a file



athulms
11th October 2011, 22:55
how can i delete a file i used the code

dir=new QDir(dir->currentPath());
QFile file3(dir->filePath("Time.xml"));
file3.remove();
but it doesnot works and returns false.

wysota
11th October 2011, 23:17
QFile::remove("Time.xml"); // assuming Time.xml is in current dir

ChrisW67
13th October 2011, 02:19
... and check the return value of QFile::remove() and QFile::error() if you want to know when and why it failed (for example, the file does not exist, is locked, or you have insufficient permission).