Format
#include <direct.> int mkdir(char *pathname);
Language Level: XPG4, Extension
mkdir creates a new directory with the specified pathname.
Because only one directory can be created at a time, only the
last component of pathname can name a new directory.
Note: In earlier releases of the C/C++ run-time library, mkdir began with an underscore (_mkdir). Because it is defined by the X/Open standard, the underscore has been removed. For compatibility, IBM C and C++ Compilers will map _mkdir to mkdir for you.
Return Value
mkdir returns the value 0 if the directory was created.
A return value of -1 indicates an error, and errno is set to one
of the following values:
| Value | Meaning |
| EACCESS | The directory was not created; the given name is the name of an existing file, directory, or device. |
| ENOENT | The pathname was not found. |
![]()
chdir -- Change Current Working Directory
_getcwd -- Get Path Name of Current
Directory
_getdcwd -- Get Full Path Name of
Current Directory
rmdir -- Remove Directory
<direct.h>