博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
快速创建多层文件夹
阅读量:4125 次
发布时间:2019-05-25

本文共 807 字,大约阅读时间需要 2 分钟。

转载来自:http://blog.csdn.net/shen_001/article/details/6823049
BOOL CreateDirectory(  LPCTSTR ,  LPSECURITY_ATTRIBUTES );这个是大多数用户都知道的,但是这个有缺点,只能是一层一层的创建。。。很是麻烦!!!
 
下面给大家介绍一个函数:
BOOL MakeSureDirectoryPathExists(  PCSTR ); 
Client
Requires Windows XP or Windows 2000 Professional.
Server
Requires Windows Server 2003 or Windows 2000 Server.
Redistributable
Requires DbgHelp.dll on Windows NT 4.0 and Windows Me/98/95.
Header
Declared in Dbghelp.h.
Library
Link to Dbghelp.lib.
DLL
Requires Dbghelp.dll.

 

 

这个是MSDN上说的需要 Dbghelp.h  但是这样不管你怎么实验,都是不成功!

把头文件改成如下就可以正确使用了

#include "imagehlp.h"

#pragma comment(lib,"imagehlp.lib")

 

MakeSureDirectoryPathExists("F:\\DVR\\123\\123\\dfd\\asdf\\a\\adf\\");

1.文件路径完全不存在。

2.文件路径存在一部分。

这些都是完全可以实现!!

你可能感兴趣的文章
Valid Parentheses --括号匹配
查看>>
Remove Element--原地移除重复元素
查看>>
Remove Duplicates from Sorted Array--从有序数组中移除重复元素
查看>>
Count and Say
查看>>
Gas Station
查看>>
Palindrome Partitioning --回文切割 深搜(重重)
查看>>
Valid Palindrome 简单的回文判断
查看>>
Pascal's Triangle -- 生成杨辉三角
查看>>
Pascal's Triangle II 生成杨辉三角中的某行
查看>>
Minimum Depth of Binary Tree -- 二叉树的最小深度 DFS 加剪枝
查看>>
Climbing Stairs 爬楼梯方法 动态规划
查看>>
Merge Two Sorted Lists 合并两个有序链表
查看>>
pow(x,n) 为什么错这么多次
查看>>
Jump Game 动态规划
查看>>
Binary Tree Maximum Path Sum 自底向上求解(重重重重)
查看>>
Subsets 深搜
查看>>
Subsets II
查看>>
Edit Distance 字符串距离(重重)
查看>>
Gray Code 格雷码
查看>>
对话周鸿袆:从程序员创业谈起
查看>>