hello, first time posting here.
I have a problem with execlp and I can't seem to find the answer using google. The solution must be really silly but I can't find it and I'm running out of time!
A simplified version of what I'm trying to do would be this:
I need to write a c program that recursively runs the directory given as the first parameter and copy it in the directory given as the second parameter through a pipe using the "cp" command in linux.
(for example "./progname firstdir seconddir")
this is the part where a file is found and is sent through the pipe to be copied by cp
and this should be the part where I fork() , redirect tube to STDIN_FILENO , and execlp to "cp"Code:sprintf(file_route,"%s/%s",dir_route,dir_entry->d_name); write(tube,file_route,strlen(file_route));
so what I can't figure out is what the heck I'm supposed to add as arguments to execlp.Code:close(tube); dup2(tube,STDIN_FILENO); close(tube); execlp("cp","cp",something something I dunno,NULL);
I hope the code is not too limited to make sense and thanks in advance.