How do I use multiple arguments from an array to construct an execl() call in C?
- by chucknelson
I have a string array in C named args[] - now how can I use this list of arguments to construct a proper call to execl()?
So if the array contains:
{"/bin/ls","ls","-a","-l"}
...how can I eventually construct an execl() call that is:
execl("/bin/ls","ls","-a","-l",NULL);
I must be thinking about this wrong, as I can't find anything online, just talk about defining functions that can take a variable number of arguments.