Linux execl 和 execv 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9123697/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 04:21:26  来源:igfitidea点击:

What is the difference between execl and execv?

clinuxexec

提问by Ahmet Tanakol

I use execvinstead of execl. To use execv, I create an array and put arguments that I use with execlin there. Then I put this array into execv

我使用execv代替execl. 要使用execv,我创建了一个数组并将我使用的参数execl放入其中。然后我把这个数组放入execv

I know I have to use an array of arguments for execvbut why? What is the difference between execland execv?

我知道我必须使用一组参数,execv但为什么呢?execl和 和有execv什么区别?

回答by mark4o

There is no difference other than the format of the arguments. They will both end up calling the same underlying system call execve().

除了参数的格式之外没有区别。他们最终都会调用相同的底层系统调用execve()