I've c code that uses fork and execvp functions, The intent of the code is copy a src_file to target_path once the copying is done, Notify the user, of its status(print msg)
I know that the usage of execvp will replace the current process image. what i wanted to know is, are there any alternatives, such that upon completion of the cmd given to execvp the control returns to my program and run the successive code.
pid = fork();
if (pid == 0) {
/* child path */
printf("Hello, This is CHILD(%d).\n", getpid());
execvp("cp", av);
printf("Completed Copying\n");
}
else {
/* Parent's path */
printf("Hello, This is PARENT(%d).\n", getpid());
wait(NULL);
}