This is an example that our professor gave us for execl(). There are 2 files in a folder, com1.c looks like
#include <stdio.h>
#include <unistd.h>
int main(){
printf("hello...");
fflush(stdout);
execlp("com2","com2",(char*)NULL);
perror("err at execl");
return 1;
}
and com2.c looks like
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(){
write(1, "...you unicorn ;)",13);
return 0;
}
At runtime it gives me this message:
hello...err at execl: No such file or directory
How can I get "hello...... you unicorn ;" ? Anticipated thanks.