Search

Using execv

execv like all other calls of the exec family,creates a new process replacing the current process.

The syntax of execv is



Arguments:



The operation is exactly same as that of execve as described in "Usage of execve". The only differece is that execv does not take the third argument



Here is an example of using execv :

Let us take a program to print hello world.

hello.c :



compile this to generate the executable hello



Here is a program that will launch the executable hello using execv



Output:




2 comments:

  1. Thanks. The helped me resolve an issue I was having while supporting a "distributed computing" project. All of my jobs of a certain type that called "execv" were failing. Once I found the required RPM I could use your two "C" programs to test.

    ReplyDelete