As Kerrek SB already said, execvp
does not return.
To add a little more info: the execv
-family of functions replaces your process (running program) with another. This, in cooperation with fork
is what happens inside a system()
call.
To put it more bluntly:
If you want to run a system command from your C program, and carry on based on "return" value, you should use the system()
call. See example.
If you want to spawn a child process, which should run another executable, you should fork
, and inside the child process use execv
. See the following example.