QFileInfo获取文件信息

它可以获取很多文件的信息,比如文件的大小,文件的类型,文件的创建日期等等

下面是获取一些文件信息的方法:

先要头文件:

#include<QFileInfo>
QFileInfo info(path);
        qDebug()<<QString(QStringLiteral( "The file's name is")) 
        <<info.fileName().toUtf8().data();
        qDebug()<<"The file's date is:"<<info.suffix().toUtf8().data();
        qDebug()<<QString("The size of file is")<<info.size();
        qDebug()<<QString("The path of the file is")<<info.filePath().toUtf8().data();

猜你喜欢

转载自blog.csdn.net/scwMason/article/details/81130417