Illustration of GETENV system call , which is used to fetch a Environment variable

//Code is written for GNU/LINUX operating systems
#include<stdio.h>
int main()
{
    char *ptr,*getenv();
    ptr=getenv("HOME");
    if(ptr==(char *)0)
     printf("home not found ");
    else
     printf("\n%s",ptr);
    return 0;

}

Advertisements

2 thoughts on “Illustration of GETENV system call , which is used to fetch a Environment variable

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s