getenv example in C



Syntax:  char* getenv(const char* name)

Arguments Passed: Name of the environmental variable

Return Value:  Value of the environmental variable if present else returns null


Code:



#include<stdio.h>
#include<stdlib.h>

int  main()
{

printf("HOME Path :%s\n",getenv("HOME"));
printf("ROOT Path :%s\n",getenv("ROOT"));
printf("USER :%s\n",getenv("USER"));
printf("Present Working Directory: %s\n",getenv("PWD"));
return 0;

}

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig