System Software Lab Programs ( UNIX Programs ) – 7b
// June 7th, 2009 // Educational, Engineering, Unix and System Software Lab // Written by sandeephegde
-->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 ]
If you enjoyed this post, make sure you subscribe to my RSS feed!
Related posts:
-
mspatel
-
sandeephegde
-
mspatel



