How to get the return value of a program ran via calling a member of the exec family of functions?

后端 未结 5 2072
面向向阳花
面向向阳花 2020-11-27 06:45

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\", \"/         


        
5条回答
  •  眼角桃花
    2020-11-27 07:29

    You can wait on the child process and get its exit status. The system call is wait(pid), try to read about it.

提交回复
热议问题