putenv [message #93939] |
Sun, 04 May 2003 23:52 |
Norvin
Messages: 22 Registered: July 2001
|
Junior Member |
|
|
hi all, i want to know if is there a way to set environment variable inside unix c program and that environment variable remain even when the program ends.
if i have a code like this
main()
{
putenv("HOME=/usr/name");
printf( "%sn", getenv("HOME") );
return( 0 );
}
the environment variable HOME is set, only when the program is running, how about it retail its value even when the program ends
Thanks,
Norvin
|
|
|
Re: putenv [message #94045 is a reply to message #93939] |
Tue, 18 November 2003 07:20 |
Frank Naude
Messages: 4581 Registered: April 1998
|
Senior Member |
|
|
Hi,
Try to run your C-program within the "current shell" by
executing it like this:
. ./programName
Best regards
Frank
|
|
|