Home » Developer & Programmer » Precompilers, OCI & OCCI » putenv
putenv [message #93939] Sun, 04 May 2003 23:52 Go to next message
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 Go to previous message
Frank Naude
Messages: 4579
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
Previous Topic: Creating 32-bit executables for 64-bit installation
Next Topic: core dump on OCI calls
Goto Forum:
  


Current Time: Fri Mar 29 07:44:38 CDT 2024