How can you run execvp with a "*.c". I can get it to work with a full name but not a wildcard. Any help would be greatly appreciated. This is what I have so far.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void) {
printf("running\n");
char* args[] = { "find", "-name", "one.c", NULL};
char * envp[] ={NULL};
int pid = fork();
switch(pid){
case -1:
perror("fork() failed");
exit(1);
case 0: // child
execvp(args[0], args);
printf("after the exec\n");
default: // parent
//wait(NULL);
if(wait(NULL) == -1){
perror("wait() failed");
}
}
return 0;
}