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
What is the difference between execl and execv?
提问by Ahmet Tanakol
I use execv
instead of execl
. To use execv
, I create an array and put arguments that I use with execl
in there. Then I put this array into execv
我使用execv
代替execl
. 要使用execv
,我创建了一个数组并将我使用的参数execl
放入其中。然后我把这个数组放入execv
I know I have to use an array of arguments for execv
but why? What is the difference between execl
and 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()
。