检测并创建文件夹

Posted nanqiang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了检测并创建文件夹相关的知识,希望对你有一定的参考价值。

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

 

以上是关于检测并创建文件夹的主要内容,如果未能解决你的问题,请参考以下文章