What's the use of the third, environment variable argument to the C++ main()?

前端 未结 4 416
误落风尘
误落风尘 2020-12-17 03:40

I have come to understand that char **envp is the third argument to main, and with the help of the code below, I was able to see what it actually c

4条回答
  •  醉梦人生
    2020-12-17 04:22

    This is typically used to set configuration options or other information for a whole group of programs. Another use is to specify environment settings for a particular machine or user setup.
    Well known examples are the PATH variable that contains the lookup pathes for executables, or the LD_LIBRARY_PATH variable that contains the pathes where to lookup the shared libraries.

提交回复
热议问题