日期:2014-05-16 浏览次数:20731 次
int CreateDir(const char *sPathName) { char DirName[256]; strcpy(DirName, sPathName); int i,len = strlen(DirName); if(DirName[len-1]!='/') strcat(DirName, "/"); len = strlen(DirName); for(i=1; i<len; i++) { if(DirName[i]=='/') { DirName[i] = 0; if( access(DirName, NULL)!=0 ) { if(mkdir(DirName, 0755)==-1) { perror("mkdir error"); return -1; } } DirName[i] = '/'; } } return 0; }
------解决方案--------------------
貌似没有现成的函数,需要自行编写