| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f |
| From: | "Amber N. Stange" <nicci AT eluviis DOT ohsu DOT edu> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | msdos / djgpp exporting env vars |
| Date: | Mon, 4 Mar 2002 17:23:29 -0600 |
| Organization: | Navix Internet Subscribers |
| Lines: | 38 |
| Message-ID: | <a60vlh$67h$1@iac5.navix.net> |
| NNTP-Posting-Host: | cras7p14.navix.net |
| X-Trace: | iac5.navix.net 1015284209 6385 162.40.84.208 (4 Mar 2002 23:23:29 GMT) |
| X-Complaints-To: | abuse AT navix DOT net |
| NNTP-Posting-Date: | 4 Mar 2002 23:23:29 GMT |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2919.6600 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6600 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
I am wondering if there is a way to (much like exporting in Linux) set an
environmental variable via putenv(); function and export this variable so
when the program has terminated that the variable will still be a part of
the msdos environmental variables. Allow me to give a short example.. Say
I wanted to do something like so.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
// Environmental String Variables
char user[100];
char name[100];
printf("Username: ");
scanf("%s",user);
sprintf(name,"set user=%s",user);
putenv(name);
return 0;
}
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?
Regards,
Mrs. Amber Nicole Stange
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |