I am writing a C program in linux.
I have created a process and forking it to create a child. I want to run another program in this child so I am using execlp
. But, this program must run in an independent window.
if ( (execlp("xterm","xterm","-e","./Child1", "127.0.0.1", (char *) 0)) < 0) {
printf("Failed to Start the Echo Client. Exiting application.");
return 1;
}
Child1.c
is a simple program which is in the same directory as my current file.
On execution the code runs fine with the xterm window coming up but I get an error "xterm: Can't execvp: No file or directory"
Can you please suggest me a resolution?