I have a piece of code which creates a directory from a string, cwd here is a string giving the directory path. Unfortunately there was an error which didn't allow me to create the directory, so I used the perror() and strerror() functions like so, to get the symbolic name of the error.
struct stat st = {0};
if (stat(cwd, &st) == -1) {
if(mkdir(cwd, 0700)==-1){
int err=errno;
perror("MKDIR ERROR");
printf("%s \n",strerror(err));
}
}
My problem is that perror() and strerror() give an error saying 'No such file or directory exists'. I looked up the man page of mkdir here, but the said error is not in the list of errors given on the man page. Am I doing something wrong?