且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么是EXEC在C ++中使用的不同版本?

更新时间:2021-07-24 21:23:57

的区别是的组合:


  1. L比V :您是否想传递参数给exec'ed程序作为

  1. L vs V: whether you want to pass the parameters to the exec'ed program as


  • :在调用(可变参数列表)个别参数: EXECL() execle() execlp() execlpe()

  • V :作为一个字符数组* execv()的execve() execvp() execvpe()

  • L: individual parameters in the call (variable argument list): execl(), execle(), execlp(), and execlpe()
  • V: as an array of char* execv(), execve(), execvp(), and execvpe()

当的要被发送到exec'ed过程参数的数目是可变的阵列格式是很有用的 - 如在事先不知道,所以不能把一个固定数目的参数的函数呼叫。

The array format is useful when the number of parameters that are to be sent to the exec'ed process are variable -- as in not known in advance, so you can't put in a fixed number of parameters in a function call.

电子:用在最后一个'e'的版本,让你额外传递的char *数组是一组EXEC之前加入到生成的进程环境字符串编辑程序启动。然而传递参数,真正的另一种方式。

E: The versions with an 'e' at the end let you additionally pass an array of char* that are a set of strings added to the spawned processes environment before the exec'ed program launches. Yet another way of passing parameters, really.

P :在那里有P的版本使用环境路径变量
搜索名为执行可执行文件。没有P的版本需要的绝对或相对文件路径为prepended可执行的文件名,如果它不在当前工作目录。

P: The versions with 'p' in there use the environment path variable to search for the executable file named to execute. The versions without the 'p' require an absolute or relative file path to be prepended to the filename of the executable if it is not in the current working directory.