TCHAR* envp[]: What is it?
I created a VC++ console project with Visual Studio and it auto-generated this function:
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]开发者_如何学JAVA) { ... }
I was just wondering what envp
stands for and how/when I can/should use it?
Thank you!
The envp
argument above will store the environment variables.
The envp array, which is a common extension in many UNIX® systems, is used in Microsoft C++. It is an array of strings representing the variables set in the user's environment. This array is terminated by a NULL entry. It can be declared as an array of pointers to char(char *envp[ ]) or as a pointer to pointers to char(char **envp). If your program uses wmain instead of main, use the wchar_t data type instead of char. The environment block passed to main and wmain is a "frozen" copy of the current environment.
Source
精彩评论