Solved

write a program in C to show current enviornment variable under linux

Posted on 2006-07-09
9
345 Views
Last Modified: 2010-04-15
Hi,

help me to write a program in C to show current enviornment variable under linux..

thanks,
0
Comment
Question by:arijit_rebaca
9 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 17070847
Hi arijit_rebaca,

This is what you are looking for
http://www.die.net/doc/linux/man/man5/environ.5.html

Cheers!
sunnycoder
0
 

Author Comment

by:arijit_rebaca
ID: 17070932
no..

I want to write a C code that will show this enviornment variables...

0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 50 total points
ID: 17071048
environ points to char ** which holds your environement variables ... All you need to do is iterate over this array of strings and print the values!!!!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:arijit_rebaca
ID: 17071216
Can u write whole code block? it will be helpful for me...

thanks,


0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 17071228
Your question history indicates that you are in the process of learning C.
I would be glad to help you code this piece but I wont code it for you.

Also, you should consider managing your open questions and grading history ... 9 Bs out of 10 certainly dont look very encouraging.
http://www.experts-exchange.com/help.jsp#hi73
0
 
LVL 8

Expert Comment

by:manish_regmi
ID: 17072024
another hint,
  That environ pointer which sunny pointer is the third paramenter to the main
also see getenv() if you want to retrieve the value of specfic value.

regards
Manish Regmi
0
 
LVL 86

Expert Comment

by:jkr
ID: 17085591
Paul - I ABSOLUTELY DISAGREE ON DELETING COMMENTS WITHOUT MENTIONING THAT to the others.

As I side note: I'll ask the admins about that conduct, since not only it is impolite and rude, but also unfair and IMO not justified. Not to speak of professionality here.
0
 

Author Comment

by:arijit_rebaca
ID: 17089049
Hi PaulCaswell,

Ya.... you r right Paul.... ok I try to rectify myself when I am going to grade an answer... Thanks for recollecting my school days.... specially the teachers who are very very poor to give marks. hahahahhahahahhaha........

rgds,

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Statment to match two tables in c# 6 81
C++ finding a sting in a char* string from a text file 3 130
smtp c source code 7 105
Reactjs with .NET 3 70
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question