How do I use multiple arguments from an array to construct an execl() call in C?
Posted
by chucknelson
on Stack Overflow
See other posts from Stack Overflow
or by chucknelson
Published on 2010-04-10T15:53:36Z
Indexed on
2010/04/10
16:03 UTC
Read the original article
Hit count: 235
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.
© Stack Overflow or respective owner