In my code I try to remove the contents of a folder using this
(makargv is a function that tokenizes the string - let me know if you wanna see it)Code:if((nTokens = makeargv("rm /tmp/.tmp_cache/*.*", " ", &tokens)) == -1 ){ printf("Ocorreu um erro ao separar o comando em tokens.\n"); } else{ if(execvp("rm", "rm", "/tmp/.tmp_cache/*.*", NULL) == -1){ perror("Error executing execvp : "); } }
The output for it isbut if I tryCode:rm: cannot remove `/tmp/.tmp_cache/*.*': No such file or directoryon the same shell just after the program ends it wirks fine.Code:rm /tmp/.tmp_cache/*.*
I have no idea of what can be wrong. Please help.



LinkBack URL
About LinkBacks



