MakeSureDirectoryPathExists与CreateDirectory的区别

来源:互联网 发布:桌面图标隐藏软件 编辑:程序博客网 时间:2024/05/17 00:01

函数原型:

MakeSureDirectoryPathExists(
    _In_ PCSTR DirPath
    );

CreateDirectory(
    _In_ LPCSTR lpPathName,
    _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes
    );


二者的功能都是创建指定文件。

但是MakeSureDirectoryPathExists可以创建多级目录,如DirPath=“E:\\q\\w\\e”,如果q文件夹不存在也是可以创建成功的。而CreateDirectory只能创建一级目录。

如果想要使用MakeSureDirectoryPathExists,则必须包含头文件imagehlp.h,并链接imagehlp.lib。以下是下载地址:

32位:                                       64位:

Imagehlp32工具集                  Imagehlp64工具集


当然也可以用dll。 

1 0