#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
int main(int argc, const char *argv[])
{
char* original_path = "/home/userxxx/somedir/newdir";
if (mkdir(original_path,0777) == -1) {
perror(argv[0]);
exit(EXIT_FAILURE);
}
return 0;
}
Please remember, this is not the system call, so i cannot use -p to create parent directories, i have to use the posix function , that should also create the parent and intermediate directories if they dont exist.