检测并创建文件夹

     std::string folderPath = "c:"+ "\\log";
     std::string command;
     command = "mkdir -p " + folderPath;
//     system(command.c_str());
     if (0 != access(folderPath.c_str(), 0))
     {
           // if this folder not exist, create a new one.
           mkdir(folderPath.c_str());   // 返回 0 表示创建成功,-1 表示失败
//           qDebug() << folderPath.c_str();
      }

 

posted @ 2019-06-20 12:06  cicero  阅读(256)  评论(0编辑  收藏  举报