C++ QT notes

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 ();
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325360684&siteId=291194637