Enter your email address & Win:

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:

  1. System Software Lab Programs ( UNIX Programs ) – 6b
  2. System Software Lab Programs ( UNIX Programs ) – 5b
  3. System Software Lab Programs ( UNIX Programs ) – 3b
  4. System Software Lab Programs ( UNIX Programs ) – 1B
  5. System Software Lab Programs ( UNIX Programs ) – 4b
  • mspatel
    How to your programs in linux
  • sandeephegde
    Dear mspatel,

    The programs will run on any Linux flavor like fedora.
  • mspatel
    It is very nice to your programs in your site,Thanks for you.
blog comments powered by Disqus
Get Adobe Flash playerPlugin by wpburn.com wordpress themes