在C ++中创建目录树的功能 [英] Function to create directory tree in C++

查看:122
本文介绍了在C ++中创建目录树的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







在Windows上使用C ++中的任何函数(win32或MFC)



1)在给定路径下创建目录树。

,例如如果path是c\Test1\Test2\Test3

那么该函数应该创建磁盘上不存在的所有目录。

我知道我们可以通过标记路径并在每个directoey上使用 CreateDirectory 函数来实现这一点,但我正在寻找一个现成的函数来完成这项任务。

Hi,


Is ther any function in C++ on windows(win32 or MFC) for

1 ) Creating a directory tree at given path.
e.g. if path is c\Test1\Test2\Test3
Then the function should create all directories which does not exist on the disk.
I know we can achieve this by tokenizing the path and using CreateDirectory function on each directoey, but i am looking for a readymade function to do this task.

推荐答案

是的,有这样一个功能: SHCreateDirectoryEx

[ ^ ]。要使用它,您必须包含 shlobj.h 并链接 shell32.lib
Yes, there is such a function: SHCreateDirectoryEx
[^]. To use it you must include shlobj.h and link with shell32.lib.


这篇关于在C ++中创建目录树的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆