I know that it is possible to read commands output with a pipe? But what about getting return value ? For example i want to execute:
execl("/bin/ping", "/bin/ping" , "-c", "1", "-t", "1", ip_addr, NULL);
How can i get returned value of ping command to find out if it returned 0 or 1?
Here is an example I wrote long time ago. Basically, after you fork a child process and you
waitits exit status, you check the status using two Macros.WIFEXITEDis used to check if the process exited normally, andWEXITSTATUSchecks what the returned number is in case it returned normally: