mkdir c++ function

c++, visual-studio-2008

Solution

If you want to write cross-platform code, you can use `boost::filesystem` routines

#include <boost/filesystem.hpp>
boost::filesystem::create_directory("dirname");

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.

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.

Problem

I need to use the mkdir c++ function in VS 2008 which takes two arguments and is deprecated from VS 2005. However this function is used in our code and I need to write a standalone product (containing only mkdir function) to debug something. 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); ```

Original source

Related problems