I have a father process and a child process, the second created with fork, the child receive from the father a char s[] (s can be something like "cd Music" ), i extract Music from "cd Music" using strtok, but when chdir(dir) executes i get "No such file or directory". But if i test chdir("Music") i get no error. I want to change the working directory of the child process. Help me please...
char *dir = strtok(s," ");
dir = strtok(NULL," ");
if(chdir(dir) == -1){
perror("Cannot change directory");
}