跨平台方式制作目录? [英] Cross Platform Way to make a directory?

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

问题描述

是否可以使用标准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 :: filesystem 和适当的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天全站免登陆