开发者

TCHAR* envp[]: What is it?

开发者 https://www.devze.com 2023-01-03 12:08 出处:网络
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 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号