Path: utzoo!mnetor!uunet!husc6!mailrus!ames!pasteur!ucbvax!agate!saturn!ucscb.UCSC.EDU!lupin3 From: lupin3@ucscb.UCSC.EDU (-=/ Count Lupin III /=-) Newsgroups: comp.sys.ibm.pc Subject: Changing environment PERMANENTLY from within a C program Message-ID: <2621@saturn.ucsc.edu> Date: 4 Apr 88 02:34:13 GMT Sender: usenet@saturn.ucsc.edu Reply-To: lupin3@ucscb.UCSC.EDU (-=/ Count Lupin III /=-) Organization: MetaWare, Incorporated Lines: 37 My older brother has a request; since he does not bother to read the net (he feels my time is worthless enough :) he had me post this, and read all the replies. I have been watching for subjects which addressed this question, and have seen none; so I have posted this article. If you feel that this info is current enough to do a followup, fine; otherwise, you can mail me your answer, or mail it directly to him (acct. "webster", same path). Here is his question: | o / +------X---cut-here----------------------------------- | O \ Can someone tell me a way to change an environment variable from within a C program, and have the change be permanent when the program terminates? Using the putenv() call only changes the copy of the environment local to the C program; I need a way to change the environment of the COMMAND shell which exec'ed the C program. A magazine I read suggested this as the solution: system( "SET FOO=BAR"); but this did not work for me. The environment remained unchanged when the program terminated. | o / +------X---cut-here----------------------------------- | O \ aTdHvAaNnKcSe. -- /|\ /|\ .. . . . . . . . . . . | |\| |\| .. . . . . . . . . . . |/|\|/|\|/|| _ _ _ _ |_| _ _ |_ -__ _ _ARPA: lupin3@ucscb.ucsc.EDU | |/| |/|L_ (_\( ( (_/ | |(_\_) (_ || )(_)_)UUCP: *!ucbvax!ucscc!ucscb!lupin3 \|/ \|/ larry / hastings _/ BITNET: lupin3@ucscb@ucscc.BITNET MetaWare Inc "I saved Esquire readers from exploding pies." --Michael J. Fox Sail the High C! Disclaimer:[MetaWare, UCSC] -> opinion != lhastings -> opinion