C - How can i get return value of command passed to execl?

Posted by Skuja on Stack Overflow See other posts from Stack Overflow or by Skuja
Published on 2010-04-19T11:52:46Z Indexed on 2010/04/19 12:03 UTC
Read the original article Hit count: 259

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about c

    Related posts about exec