Mega Code Archive

 
Categories / C / Code Snippets
 

Get environment variable how to use getenv

#include <stdio.h> #include <stdlib.h> int main () { char *p; p = getenv ( "PATH" ); if (p != NULL) printf ("Current path is: %s", p); return 0; }