Name: execl()
|
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 argv to that invoked program. |
What libraries you must include: #include <unistd.h> // Defines execl().
|
Syntax: int execl (const char *path, char *const arg, ...);
|
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
|
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: execl ("/bin/ls", "ls", "~/cisc3350-hw", NULL);
perror ("execl"); /* execl() returns only on error */
|
Other variations: execve() , execv() , execvp() , execle() , execlp()
|