Mail Archives: djgpp/2002/03/05/01:27:41
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 -