跨平台的方式来创建包含子文件夹的目录? [英] Cross Platform Way to make a directory including subfolders?

查看:61
本文介绍了跨平台的方式来创建包含子文件夹的目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用标准c或c ++库创建目录,包括给定绝对路径字符串时可能需要的子文件夹?

Is there a way using the standard c or c++ library to make a directory, including the subfolders that may be required given a string of the absolute path?

谢谢

推荐答案

否,但是,如果您愿意使用boost:

No, however if you're willing to use boost:

boost::filesystem::path dir("absolute_path");
boost::filesystem::create_directory(dir);

有一个提案将文件系统库添加到基于 boost :: filesystem 的标准库中.使用<代码>的boost ::文件系统的和适当的typedef将使你在一个很好的位置迁移到未来的标准,当它成为可供您选择的编译器.

There is a proposal to add a filesystem library to the standard library that will be based on boost::filesystem. Using boost::filesystem and appropriate typedefs will put you in a good position to migrate to the future standard when it becomes available for your compiler of choice.

这篇关于跨平台的方式来创建包含子文件夹的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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