c++创建文件夹方法(在ubuntu上,和windows上略有不同)。
#include#include #include #include #include int creat_path(std::string test) { if(access(test.c_str(), 0) == 0){ std::cout << "The file is exist" << std::endl; return 1; } else mkdir(test.c_str(),S_IRUSR | S_IWUSR | S_IXUSR | S_IRWXG | S_IRWXO); return 0; } int main() { std::string test = "test"; creat_path(test) return 0; }
`



