if you use C++, and you have the boost libraries, you can use them
Code:
boost::filesystem::path dir(path);
if(boost::filesystem::create_directory(dir)) {
// ....
}
in this way you are also platform independent, (beside your path)
if not, the docu is your friend
Quote:
The argument mode specifies the mode for the new directory (see
stat(2)). It is modified by the process's umask in the usual way: in
the absence of a default ACL, the mode of the created directory is
(mode & ~umask & 0777). Whether other mode bits are honored for the
created directory depends on the operating system. For Linux, see
NOTES below.
|
notes can be found here
http://man7.org/linux/man-pages/man2/mkdir.2.html
from the examples :
Code:
#include <sys/types.h>
#include <sys/stat.h>
int status;
...
status = mkdir("/home/cnd/mod1", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
is a good default so you can use this . umask will set the defaults than anyway for you