在C ++中创建目录树的功能

编程入门 行业动态 更新时间:2024-10-26 06:28:38
本文介绍了在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 ++中创建目录树的功能

本文发布于:2023-10-19 14:34:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1507814.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:功能   目录

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!