Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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[]) { ... }

I was just wondering what envp stands for and how/when I can/should use it?

Thank you!

like image 880
Simon Avatar asked Jun 16 '10 14:06

Simon


1 Answers

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

like image 91
Brian R. Bondy Avatar answered Nov 03 '22 02:11

Brian R. Bondy