Exec Family
Library Required
1#include <unistd.h>
execl()
Replaces current process with a new one using a path and a list of arguments
1int execl(const char *path, const char *arg, ..);
Return Values:
- Success: No return
- Error: -1
Example:
1execl("/bin/ls", "ls", "-l", NULL);
execlp()
Like execl()
but searches PATH
for the executable
1int execlp(const char *file, const char *arg, ..);
Return Values:
- Success: No return
- Error: -1
Example:
1execlp("ls", "ls", "-l", NULL);
execle()
Like execl()
but allows specifying a custom environment
1int execle(const char *path, const char *arg, .., char * const envp[]);
Return Values:
- Success: No return
- Error: -1
Example:
execv()
Replaces current process using a path and an argument vector (array)
1int execv(const char *path, char *const argv[]);
Return Values:
- Success: No return
- Error: -1
Example:
execvp()
Like execv()
but searches PATH
for the executable
1int execvp(const char *file, char *const argv[]);
Return Values:
- Success: No return
- Error: -1
Example:
execvpe()
Like execvp()
but also allows specifying a custom environment
1int execvpe(const char *file, char *const argv[], char *const envp[]);
Return Values:
- Success: No return
- Error: -1
Example:
Last updated on