进程中关于exec函数的使用问题
学习过程中遇到的问题:
- 如何使用?
- 有什么区别?
- 作用是什么?
1.如何使用?
在Linux系统中我们可以通过man 命令来进行查看:
例如:
查看man命令的使用 man man
MANUAL SECTIONS:
The standard sections of the manual include:
1 User Commands
2 System Calls
3 C Library Functions
4 Devices and Special Files
5 File Formats and Conventions
6 Games et. Al.
7 Miscellanea
8 System Administration tools and Daemons
查看exec函数使用 man 3 exec
NAME:(整个exec函数家族)
execl, execlp, execle, execv, execvp - execute a file
SYNOPSIS:
#include <unistd.h>(头文件)
extern char **environ;
exec函数家族具体形式:
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[]);
2.有什么区别?
- 函数名不同(这是废话)
- 参数不同
- 使用方法不同
在这里,我们对比这两个函数来进行使用:(其他函数类同)