1. YT_11_QDir
#include <QCoreApplication> #include<QDir> #include<QFileInfo> #include<QString> #include<QDebug> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QDir mDir; //foreach (QFileInfo mItem, mDir.drives() ) // qDebug() << mItem. absoluteFilePath(); QString mPath = "C:/text/ggg"; if(!mDir.exists(mPath)) { mDir.mkpath(mPath); } else { qDebug() << "Already exists."; } return a.exec(); }
#include<QCoreApplication>
#include<QDir>
#include<QFileInfo>
#include<QString>
#include<QDebug>
intmain(intargc,char*argv[])
{
QCoreApplicationa(argc,argv);
QDir mDir ;
//foreach(QFileInfomItem,mDir.drives())
//qDebug()<<mItem.absoluteFilePath();
QStringmPath="C:/text/ggg";
if(!mDir.exists(mPath))
{
mDir.mkpath(mPath);
}
else
{
qDebug()<<"Alreadyexists.";
}
return a . exec ();
}