void casMkdir(const char* dir)
{
int nIndex = 1;
char* tmp = (char*)dir;
while ( nIndex < strlen(dir) + 1 )
{
if (*(dir+nIndex) == '/' || *(dir+nIndex) == '\0')
{
char parent[256] = {0};
strncpy(parent, dir, nIndex);
if (0 != access(parent, 6))
{
mkdir(parent, 0755);
}
}
nIndex++;
}
}
linux c 创建多级目录接口实现
最新推荐文章于 2024-08-16 16:51:26 发布