'How is argv passed to the new process image with execvp()?
The man page does not seem to specify how this is done. I am confused particularly because of this line from here: The argv[] and envp[] arrays of pointers and the strings to which those arrays point shall not be modified by a call to one of the exec functions, except as a consequence of replacing the process image.
Are the argument arrays copied somewhere before the process image is replaced? That line seems to imply that they are always modified because the process image is always replaced.
I see that the document also says the following: The statement about argv[] and envp[] being constants is included to make explicit to future writers of language bindings that these objects are completely constant.
I feel like this could help my understanding but I'm not entirely sure exactly what they are saying is constant here.
In addition I would like to know why it is good or bad to cast the constant c_str() from std::string to pass to execvp() in the argv.
Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
