FAQ Database Discussion Community

execl() works on one of my code, but doesn't work on another

I already used execl() in code, and it worked well. But this time, I really have no idea why it doesn't work. So here's the code that do not work #include <unistd.h> #include <stdio.h> int main() { int i = 896; printf("please\n"); execl("home/ubuntu/server/LC/admin/admin", (char*)i, NULL); printf("i have no idea why\n");...

How to run my stdin through the cut command using the execl() function?

My objective is to make an IPC between a child and parent through a FIFO. The child should run execl ("/bin/cat", "cat", "/etc/passwd", (char *)0); redirect its output to the parents input and the parent should run this command: cut -l : -f 1 and output this to command line....

Why does execl require me to hit “Enter” after running a process?

In bash, when I type ls and hit enter, the binary ls will run and I will return to shell prompt again without doing anything from my side. However this program, written in C will block: #include <sys/types.h> #include <stdio.h> #include <unistd.h> int main(void) { pid_t other = fork(); //...