Skip to content

Instantly share code, notes, and snippets.

@s16h
Created November 8, 2012 23:42
Show Gist options
  • Save s16h/4042649 to your computer and use it in GitHub Desktop.
Save s16h/4042649 to your computer and use it in GitHub Desktop.
A short C function to get the current value of the PATH environment variable.
/* getenv example: getting path */
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char * pPath;
pPath = getenv("PATH");
if (pPath!=NULL)
printf ("The current path is: %s",pPath);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment