mkdir and rmdir

You can create and remove directories using the mkdir and rmdir system calls.

#include <sys/types.h>
#include <sys/stat.h>
int mkdir(const char *path, mode_t mode);


The mkdir system call is used for creating directories and is the equivalent of the mkdir program. mkdir
makes a new directory with path as its name. The directory permissions are passed in the parameter
mode and are given as in the O_CREAT option of the open system call and, again, subject to umask.

#include <unistd.h>
int rmdir(const char *path);

The rmdir system call removes directories, but only if they are empty. The rmdir program uses this
system call to do its job.