c - program not executing anything after a call to system() -


i calling command via system(command) call. no other code executed after system() call.

why so? thought, system() create child process "command" execution , program (parent of "command"-child) continue executing code after that.

am not understanding system() correctly?

code:

printf("before \n"); system("tail -f filename");       /* long lived - never returns */ printf("after \n"); 

here, not see after getting printed ever.

the system(3) function causes process wait completion of child.

edit 0:

you have use classic pair of fork(2) , execve(2) want do. might check whether c library provides posix spawn(3).

edit 1:

look waitpid(2) keep parent around.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -