您的位置:首页 > 其它

MFC程序中如何创建多级目录

2012-04-18 16:06 267 查看
创建多级目录函数

BOOL mkdirEx(const char* lpPath)

{

CString pathname = lpPath;

if(pathname.Right(1) != "\\")

pathname += "\\" ;

int end = pathname.ReverseFind('\\');

int pt = pathname.Find('\\');

if (pathname[pt-1] == ':')

pt = pathname.Find('\\', pt+1);

CString path;

while(pt != -1 && pt<=end)

{

path = pathname.Left(pt+1);

if(_access(path, 0) == -1)

_mkdir(path);

pt = pathname.Find('\\', pt+1);

}

return true;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: