栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

exec系列系统调用(例如exec和execve)的功能之间有什么区别?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

exec系列系统调用(例如exec和execve)的功能之间有什么区别?

使用

man exec
和阅读:

The execv(), execvp(), and execvpe() functions provide an array of pointers to null-terminated strings that represent the argument list available to the new program. The first argument, by convention, should point to the filename associated with the file being executed. The array of pointers must be terminated by a NULL pointer.

execv

int execv(const char *path, char *const argv[]);

所以你传递一个数组作为参数

int execle(const char *path, const char *arg,   ..., char * const envp[]);

几乎相同,但不是一个数组,而是一个值列表(字符串),后面跟着一个数组来指定环境。

这里:

int execvp(const char *file, char *const argv[]);

您正在调用的文件没有路径,因此它希望您

path
在调用之前已经处于正确的位置。

最后但并非最不重要的:

int execve(const char *filename, char *const argv[],       char *const envp[]);

与上一个相似,但是现在有两个数组,用于参数和环境变量。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/394278.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号