web123456

【Linux: Process Program Replacement】

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

envp[]: means that programmers need to organize environment variables themselves

The difference between e and no e in function names
With e means that the programmer organizes environment variables by himself
Without e, it means that the programmer does not need to organize environment variables by himself.
The parameter with l in the function name indicates that the function is a list of variable parameters, otherwise it is not
  • int execv(const char *path,char *const argv[]);
  • int execvp(const char *file,char *const argv[]);

file: The executable program to be replaced without giving the path

argv[]: pointer array, which saves the parameters passed by the executable program

Note: 1. The first element of the array must be the executable program itself

2. The last element of the array should be NULL

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

filename: Executable program with path

argv: Parameters passed by executable program The first parameter should be itself, and the last parameter should be NULL

envp[]: The programmer organizes the environment variables by himself, and the last one must be NULL