{{keywords>wiki library source code example reference}} ====== getenv ====== #include char *getenv(const char *name); getenv matches the string pointed to by name\\ returns a pointer to the value in the environment, or NULL if there is no match.\\ ===== getenv C Sourcecode Example ===== /* * getenv example code * http://code-reference.com/c/stdlib.h/getenv */ #include /* including standard library */ //#include /* uncomment this for Windows */ #include int main ( void ) { char *env; env = getenv ("USER"); if (env!=NULL) { printf ("Your Username is: %s\n", env); } return 0; } ==== Output ==== user@host:~$ ./getenv Your Username is: code-reference.com