mkdir c++ function

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.

Leave a Comment