linux - how to find out when the code reads parent or child process and how do they communicate in C -


i have shell program fork created , used 2 if else statements separate parent , child process.

my sample program here , got few questions

while(true) {     /* read command line input */      x = fork();      if( x > 0)         {          wait(&status);               }     else         {          /* run exec() command  */         } } 

from above code statement execute first after fork , how parent know child exec command executed or unsuccessfully , when parent stop wait , in condition , how. , how wait(&status) code work.

help appreciated.

fork().

this should give better idea of how fork() system call works.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -