RE: Environment variable doubt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx] 
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@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx]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.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux