public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: lrtaylor@micron.com
To: <ashende@cisco.com>, <gcc-help@gcc.gnu.org>
Subject: RE: Environment variable doubt
Date: Mon, 29 Sep 2003 16:26:00 -0000	[thread overview]
Message-ID: <363801FFD7B74240A329CEC3F7FE4CC40D3383@ntxboimbx07.micron.com> (raw)

You can also declare your programs main function as

int main(int argc, char** argv, char** env)

You will then get your environment variables as a zero-terminated array
of character pointers, pointing to variable-value pairs in the format

VARIABLE=value

That will give you access to every environment variable defined in your
program's environment.

Thanks,
Lyle Taylor

-----Original Message-----
From: Ashay Shende [mailto:ashende@cisco.com] 
Sent: Monday, September 29, 2003 3:38 AM
To: Gcc-Help
Subject: RE: Environment variable doubt

Hi Bharati,
Could you give some more details about it.... like return type etc.

Anyways, i just tried : char* x = environ();

it gave me an error saying environ() cannot be used as a function.

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
Behalf Of Bharathi S
Sent: Monday, September 29, 2003 11:05 AM
To: Ashay Shende
Cc: Gcc-Help
Subject: Re: Environment variable doubt


On Mon, 29 Sep 2003, Ashay Shende wrote:

> Also, can anyone tell me how to get the list of all the environment
> variables and their values.

environ() -- I never used it :)

HTH :)
-- 
Bharathi S, IndLinuX Team,   (__)
DON Lab,    TeNeT Group,     oo )
IIT-Madras, Chennai-INDIA.   (_/\ 

Known is DROP, Unknown is OCEAN.


             reply	other threads:[~2003-09-29 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-29 16:26 lrtaylor [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-09-29  5:15 Ashay Shende
2003-09-29  5:35 ` Bharathi S
2003-09-29  7:23   ` Vinod Joseph
2003-09-29  9:31   ` Ashay Shende

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=363801FFD7B74240A329CEC3F7FE4CC40D3383@ntxboimbx07.micron.com \
    --to=lrtaylor@micron.com \
    --cc=ashende@cisco.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).