home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!howland.reston.ans.net!usc!cs.utexas.edu!uwm.edu!ogicse!news.u.washington.edu!glia!michael
- From: michael@glia.biostr.washington.edu (Michael)
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: Re: How do you get enviroment variables?
- Message-ID: <michael.726192782@glia>
- Date: 5 Jan 93 00:13:02 GMT
- Article-I.D.: glia.michael.726192782
- References: <1993Jan3.194240.11140@exucom.com>
- Organization: University of Washington
- Lines: 22
- NNTP-Posting-Host: glia.biostr.washington.edu
-
- In <1993Jan3.194240.11140@exucom.com> bobw@exucom.com (Bob Willer) writes:
- >How do you get the enviroment variables that are used by the system
- >with the SET command ie. in the autoexec.bat file ?
- >Bob Willer
-
- Well, if you want the value of a single environment variable, you can
- always use the getenv() call. If however you want to access the entire
- list of environment variables (or you don't know the name of one in
- particular and wish to search the entire list), then you can access the
- global variables 'environ' (in Borland C -- I assume Microsoft C has
- something similar). Environ is of this type:
-
- extern char *environ[];
-
- and is declared in <dos.h>. Environ is a NULL terminated array of
- string pointers. Each string is of the form:
-
- VAR=value
-
- Hope that helps.
-
- Michael Stanley (michael@glia.biostr.washington.edu)
-