欢迎访问:常州市武进区嘉泽中心小学网站 !今天是:
栏目列表
您现在的位置是:首页>>教师>>计算机技术>>程序设计>>杂项>>文章内容
MFC程序中如何创建多级目录
发布时间:2008-11-20   点击:   来源:本站原创   录入者:佚名
 

创建多级目录函数

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;

}


附件:
    关闭窗口
    打印文档
    账号登录
    保持登录 忘记密码?
    账号与武进教师培训平台同步