in unix, i want to modify enviroment variables.
if size of new value is larger than the old one, the room for the new variable is allocated by malloc.
however, is memory for enviroment variables above the stack? (not heap memory) where to allocate the room for new variable?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
The memory for the initial environment variables may be above the stack, but that doesn't necessarily mean that new ones need to be allocated there too.
How to allocate strings used to set environment variables depends on what function you use to set it:
May I suggest you read up on those functions?