mkdir c++ function(mkdir c++ 函数)
问题描述
我需要在 VS 2008 中使用 mkdir c++ 函数,它接受两个参数,并且在 VS 2005 中已被弃用.
I need to use the mkdir c++ function in VS 2008 which takes two arguments and is deprecated from VS 2005.
但是我们的代码中使用了这个函数,我需要编写一个独立的产品(仅包含 mkdir 函数)来调试某些东西.
However this function is used in our code and I need to write a standalone product (containing only mkdir function) to debug something.
我需要导入哪些头文件?我使用了 direct.h,但是编译器抱怨该参数没有 2 个参数(原因是该函数在 VS 2005 中已被弃用).
What header files do I need to import? I used direct.h, however compiler complains that the argument does not take 2 arguments (reason for this is the function was deprecated in VS 2005).
mkdir("C:hello",0);
推荐答案
如果你想写跨平台的代码,可以使用 boost::filesystem
例程
If you want to write cross-platform code, you can use boost::filesystem
routines
#include <boost/filesystem.hpp>
boost::filesystem::create_directory("dirname");
这确实添加了一个库依赖项,但您可能还会使用其他文件系统例程,并且 boost::filesystem
有一些很棒的接口.
This does add a library dependency but chances are you are going to use other filesystem routines as well and boost::filesystem
has some great interfaces for that.
如果您只需要创建一个新目录,并且只打算使用 VS 2008,则可以使用 _mkdir()
,正如其他人所指出的那样.
If you only need to make a new directory and if you are only going to use VS 2008, you can use _mkdir()
as others have noted.
这篇关于mkdir c++ 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:mkdir c++ 函数


基础教程推荐
- 我有静态或动态 boost 库吗? 2021-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 常量变量在标题中不起作用 2021-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01