O'Reilly logo

Hands-On System Programming with Linux by Kaiwan N Billimoria

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The execv API

The execv(3) API's signature is:

int execv(const char *path, char *const argv[]);

As can be seen, the first parameter is the pathname of the successor process. The second parameter is, similar to the environment list above, a two-dimensional array of strings (each of them NULL-terminated) holding all the arguments to pass to the successor, starting from argv[0]. Think about it, it's identical to what we, C programmers, are so used to; this is the signature of the main() function in C:

int main(int argc, char *argv[]);

argc, of course, is the number of parameters received, including the program name itself (held in argv[0]), and argv is a pointer to a two-dimensional array of strings (each of them NULL-terminated) holding all ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required