Name: execle()
|
System call or function: Function |
Links: Online Manual | Course Packet |
What it does: Replaces the code of the program that calls it with a new code at location path , and passes the arguments arg to that invoked program. |
What libraries you must include: #include <unistd.h> // Defines execle().
|
Syntax: int execle (const char *path, char *const arg, ..., char *const envp[]);
|
Description of arguments: path : the location on disk where the code of the program you want to call is stored
arg : a list of command-line argument strings that will be passed to the new program
envp : an array of pointers to strings of the form key=value, representing the environment of the new program. |
What type it returns: int
|
On success: It doesn't return: instead, the current program is replaced by the new program. |
On failure: -1
|
If failure, does it set errno ? Yes |
Quick example: execle ("/bin/ls", "ls", "~/cisc3350-hw", NULL, newenviron);
perror ("execle"); /* execle() returns only on error */
|
Other variations: execve() , execv() , execvp() , execl() , execlp()
|