c in C


unsetenv is used to delete the  variable name from the environment

Syntax : int unsetenv(const char *name);

Arguments Passed: name of the variable which you want to remove

Return  Value :  Returns zero on success else returns -1

Code:

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

int main()
{
int result=putenv("NAME=TEST");

if(result==0)
{
printf("\n environmental variable successfully written");
printf("\n value of the environmental variable written is %s",getenv("NAME"));

}else{
printf("\n error in writing the environmental variable");
}

unsetenv("NAME");
printf("\n value of the environmental variable written is %s",getenv("NAME"));

return 0;
}

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

PR, PN and PV Variable in Yocto