#include <stdio.h> #include <unistd.h> #include <string.h> #include <sys/stat.h> /** * \function MakeDir * \author PengWeizhe * \date * \param [in] path 待创建的目录路径 可以相对路径和绝对路径 * \return 0 创建成功 1创建失败 * \details 创建一个目录(单级、多级) */ int makeDir(const char* path) { int beginCmpPath; int endCmpPath; int fullPathLen; int pathLen = strlen(path); char currentPath[128] = {0}; char fullPath[128] = {0}; printf("path = %s\n", path); //相对路径 if('/' != path[0]) { //获取当前路径 getcwd(currentPath, sizeof(currentPath)); strcat(currentPath, "/"); printf("currentPath = %s\n", currentPath); beginCmpPath = strlen(currentPath);