Solved

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

Posted on 2006-07-09
9
339 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
 

Author Comment

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

thanks,


0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

896 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now