Re: [LINUX] ENV VAR addresses
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Sun, 14 Dec 2008 13:19:38 -0800
pater <pater.catania1946@xxxxxxxxx> writes:
Following a book, i read that the address of the environment variables
depends on the program name... and it won't change until u change it.
Making some tries, on my ubuntu, i found out that it changes every
time i execute the program. So, there's no way to predict what
addresses the env vars would take?
I need these infos cuz i need to put datas in the stack to be easily
picked up by the program itself, without using getenv, only with an
address.
The C standard itself doesn't say much about environment variables.
It defines the getenv() function, which returns a pointer to a string
containing the value of a specified environment variable. C doesn't
even guarantee that getenv("FOO") will return the same address when
you call it twice in a row.
Generally, *no* addresses are going to be consistent from one
execution of a program to another.
Since your question appears to be specific to Unix-like systems, I
suggest asking in comp.unix.programmer. When you do, you should be
more specific about your requirements; based on what you've written, I
can't figure out what you're trying to do.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- Follow-Ups:
- Re: ENV VAR addresses
- From: pater
- Re: ENV VAR addresses
- References:
- [LINUX] ENV VAR addresses
- From: pater
- [LINUX] ENV VAR addresses
- Prev by Date: [LINUX] ENV VAR addresses
- Next by Date: Re: ENV VAR addresses
- Previous by thread: [LINUX] ENV VAR addresses
- Next by thread: Re: ENV VAR addresses
- Index(es):
Relevant Pages
|
Loading