X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-id: Date: Tue, 05 Mar 2002 09:22:50 +0300 Subject: Re: msdos / djgpp exporting env vars To: djgpp AT delorie DOT com Cc: djgpp AT delorie DOT com From: "NirinaMichel Ratoandromanana/DS-INFO" References: In-Reply-To: MIME-Version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Reply-To: djgpp AT delorie DOT com I suggest you to drop a new shell inside your program by calling spawnvpe () and putting in an array of string all the environment variables you want to be set. e.g: char *environ[] = {"PATH=c:/djgpp/bin"; "DJGPP=c:/djgpp"; "USER=dj", 0}; char *args [] = {"command.com", 0}; spawnvpe (P_WAIT, "command.com", args, environ); //spawnvpe (P_WAIT, "cmd.exe", args, environ); for Win NT, 2K, XP p.s: example not tested but if it doesn't work, you should add the absolute path for command.com >Now of course when this program terminates the variable for user is not >going to still be set. If anyone understands what I am talking about... >I >am wanting a way other than possibly reading a cfg file to set this and >have >it become an environmental variable at least until the PC has been >restarted >or the variable has been changed. > >Any ideas?