qt判断一个文件夹中是否有文件

qt判断一个文件夹中是否有文件,第1张

#include <QDir>

#include <QDebug>

QDir dir("文件路径")

if(dir.count()==2)

    qDebug()<<"文件为空"

使用QFile::exists()函数判断。

参见 http://qt-project.org/doc/qt-4.8/qfile.html#exists-2

或者QFileInfo::exists()

参见:http://qt-project.org/doc/qt-4.8/qfileinfo.html#exists


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11791880.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存