#include<unistd.h>
extern char **environ;
int execl(const char*fullpath, const char*arg, ...);
int execlp(const char* file,const char* arg, ...);
int execle(const char* fullpath,const char* arg , ..., char*const envp[]);
int execv(const char* fullpath,char* const argv[]);
int execvp(const char* file,char* constargv[]);
int execve(const char* fullpath,const char* arg[] , char* constenvp[]);
int execl(const char* fullpath, const char* arg, ....)
使用范例:execl(“/bin/ls”, ”ls”, ”-al”, NULL)
int execlp(const char* file, const char* arg, ....)
使用范例:execlp(“ls”, ”ls”, ”-al”, NULL)
int execle(const char* fullpath, const char* arg, ...., char*const envp[])
使用范例:execle(“/bin/ls”, ”ls”, ”-al”, NULL, environ)
int execv(const char * fullpath, char* const argv[])
使用范例:execle(“/bin/mkdir”, argv)
或
char* const p[] = {"a.out", "testDir",NULL};
execv("/bin/mkdir", p);
int execvp(const char* file, const char* arg, ....)
使用范例:execlp(“ls”, argv)
或
char* const p[] = {"a.out", "testDir",NULL};
execvp("mkdir", p);
int execve(const char* fullpath, const char* arg, ...., char*const envp[])
使用范例:execve(“/bin/ls”, argv, environ)
或
char* const p[] = {"a.out", "testDir",NULL};
execve("/bin/mkdir", p);