Hi all
Enviornmental variables can acess through c or cpp code in Linux .I am giving function which can retrieve Enviornmental Variables
getenv() :=Used to acess the Enviornmental Varible
Syntax :char* getenv(const char *name) ,where name is the Required env. variable
Example code :
/* 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;
}
0 comments:
Post a Comment