c - Program execution stops when run in background -
I have a simple program that runs an application ("flute-stationary") twice (with the help of loop ) This application is interactive using Kanka () and execl (), meaning that the user uses the shell to take input and print out the output. If I run the program then there is usually no problem. But when I run a program from the background, the main program stops there. The program is here.
int main () {int i, pid; For (i = 0; i <2; i ++) {pid = fork (); If (pid == -1) {printf ("\ nerror, fork (failed)"); } Else if (pid> 0) {} other {/ * we have children * / execl ("./flute-static", "./flute-static", "-send", "-a192.168.190 1 "," / "," 6666 "," JFLit .1.2.tar.gz ", NULL); Exit (1); }} While (1) {} return 0; }
The output of running the program is:
[root @ localhost flute] # ./a.out& [3] 2643 [Root @ Localhost flute] # [3] + Shut down / A.out
Why is this happening? And how can I solve this problem? help please.
Comments
Post a Comment