Unable to get created /lastModified and lastRead time of a file
I am trying to access the created / last modified and last accessed DateTime of a file , below is my sample program -
Method signature - removeFiles(QDir &curDir, QStringList &fileList)
QString fileName;
QStringList::Iterator it;
QDateTime fileCreationDate; `
for(it = fileList.begin(); it!= fileList开发者_StackOverflow.end(); ++it){
QFile currentFile((*it));
QFileInfo currentFileInfo((*it));
fileName = currentFile.fileName();
std::cout<<" "<<fileName.toStdString()<<" creation date is: "<<currentFileInfo.created().toString().toStdString()<<std::endl;
}
` I am unable to see the created date printed on the screen . Could any one point out the mistake. Thanks
Does the fileList contain the absolute paths? You should verify that the QFileInfo object is valid. Or is your problem with the output not showing? If this is a windowed application I suggest using qDebug() for debug output instead of cout.
精彩评论