i've been trying to use execvp to run a c program but it always seems to fail.
from main.c
int main() {
char* args[] = {"2", "1"};
if(execvp("trial.c", args) == -1) {
printf("\nfailed connection\n");
}
from trial.c
int main(int argc, char** argv){
printf("working");
return 1;
}
I think i tried every way to possibly represent that file location in the exec() and it always results in "failed connection".
if(execvp(...))" No need for theif(), as the members of theexec*()family of functions only return on error.