Calling exec with a variable number of arguments?

I have a program that disables other processes. The arguments of my program include the name of the process process that needs to be forked, and any arguments.

This means that when I make the call to exec (), I need to be able to handle all the number of arguments.

Any ideas?

Thank.

+3
source share
2 answers

The function execvtakes a pointer to an array of arguments.

As in main, the last element in the array must be a null pointer.

+5
source

execl() NULL . , execv(), ; varargs C ( (, ) /usr/include/varargs.h -, !).

+1

Source: https://habr.com/ru/post/1796543/


All Articles