exec

The int exec() family of functions replace the current process with a new one.

Variants

int execl(const char *path, const char *arg, ...);
int execlp(const char *file, const char *arg, ...);
int execle(const char *path, const char *arg, ..., char * const envp[]);
int execv(const char *path, char *const argv[]);
int execvp(const char *file, char *const argv[]);
int execvpe(const char *file, char *const argv[], char *const envp[]);
FunctionDescription
execl()execute file at specified path with arguments given as a varargs list
execlp()execute a file on the PATH with arguments given as a varargs list
execle()execute file at specified path with arguments given as a varargs list and environment parameters given as a vector list
execv()execute file at specified path with arguments given as a vector list
execvp()execute file on the PATH with arguments given as a vector list
execvpe()execute file on the PATH with arguments given as a vector list and environment parameters given as a vector list

Failure

If an exec variant fails to execute successfully, the currently executing process will not be replaced, and the global errno constant will be updated with an error value that indicates the cause of the problem. The full list of errors can be viewed here.