delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/03/05/01:27:41

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Message-id: <fc.000f77f3001f08de3b9aca00c57e189e.1f0937@bni.mg>
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" <n DOT ratoandromanana AT bni DOT mg>
References: <a60vlh$67h$1 AT iac5 DOT navix DOT net>
In-Reply-To: <a60vlh$67h$1@iac5.navix.net>
MIME-Version: 1.0
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?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019