This post was published long ago, when I was a student and an amateur blogger. The links might be outdated and content may not be useful anymore. Please read this content keeping its age in mind.

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

[Click Here to get other programs by email ]

………………………………………………………………………………………………………………………….
PART -B

………………………………………………………………………………………………………………………….

7b) C program to prompt the user for the name of an environment variable and print its value if it is defined and a suitable message otherwise; and to repeat the process if user wants it.

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

int main()
{
char env[10],*p;
int ch=1;

while(ch!=0)
{
printf(“n Enter name of evironment variable :”);
scanf(“%s”,env);

p=getenv(env);
printf(“%s”,p);
printf(“n Want to change ? 1 for yes & 0 for no :”);
scanf(“%d”,&ch);
}
return 0;
}

[Click Here to get other programs by email ]