• 判断目录是否存在:
  • QString proFile(t_path);
    proFile.append("/dir");
    QFileInfo proFileInfo(proFile);
    if(proFileInfo.exists()) {
        //
    }
    

      

  • 新建目录
  •  QString t_tmpDir(theDir);
        t_tmpDir.append("/tmp");
    
    QFileInfo t_tmpDirInfo(t_tmpDir);
        QDir* t_dir = new QDir;
        if(t_tmpDirInfo.isDir()) {
            QString t_oldTmpDir(theDir);
            QDate date;
            QTime time;
            QDateTime dt;
            dt.setTime(time.currentTime());
            dt.setDate(date.currentDate());
            QString currentDate = dt.toString("yyyy-MM-dd-hh-mm-ss");
            t_oldTmpDir.append("/");
            t_oldTmpDir.append(currentDate);
            t_dir->rename(t_tmpDir, t_oldTmpDir);
        }
        t_dir->mkdir(t_tmpDir);
    

      

  • 读写文件:
  •  FILE* fp = fopen(t_pro.toStdString().c_str(), "r");
        int t_count = 0;
        fscanf(fp, "%*d%*d%*d%*d%d", &t_count);
        fclose(fp);
    

      

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2021-12-21
  • 2021-06-11
  • 2021-06-13
  • 2021-04-22
  • 2021-10-08
猜你喜欢
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2021-06-20
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案