All about programming in GNU/LINUX

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 responses

  1. works same as “pwd” in the terminal right???

    November 2, 2011 at 3:21 pm

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