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