I want to delete / delete a file from the storage file is stored in "/ share / photo /" in this way I I save the file
QByteArray * data; // Image image of a QImage image; Image.loadFromData (* data); QFile Outfile ("Share / Photo /" + File Name); OutFile.open (QIODevice :: WriteOnly); Image.save (& outfile, "PNG");
And I can successfully see the image file with this file:
QString filepath; Qustring Working = Dialer = QDir :: currentPath (); Filepath = "file: //" + Working + "/ Share / Photo /" + Filename;
And it has been seen without any problems.
The string in QString "filepath" is
"file: /// accounts /1000/appdata/com.example.project.testDev_le_Project4b5f4904/shared/photos/02 .jpg "
And now I have tried to erase / remove this file. How did I do this:
thumbnail image = file path; // Basically like string in filepath // / file / http: //accounts/1000/appdata/com.example.product.testDev_le_Project4b5f4904/shared/photos/02.jpg "QFile thumb (thumbnail image); Bool ok = Thumb.remove (); Qestring error = thumb.errorString (); if (okay) {qDebug () I also tried QFile :: remove (thumbnailImage);
and so on I still tried not to work:
QFile :: remove ("/ shared / photos /" + filename);
But Still not working, I tried to change the workdir from QDir :: currentPath ()
to QDir :: homepath ()
and still no success.
So please tell me what exactly should I put in the QFile :: remove () parameter. The reference said that the parameter is the QString file name.
bool qfile :: remove (const qustring and fileName)
Should I put the parameter? Please help me boys
Thank you.
The file path is incorrect in "file: // "Other than this, you have to open the file before removing it.
QFile thumb ("share / photo /" + file name); Thumb.open (QIODevice :: ReadWrite); Thumb.remove (); Thumb.close ();
No comments:
Post a Comment