home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4585 < prev    next >
Encoding:
Text File  |  1993-01-04  |  1.3 KB  |  35 lines

  1. 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
  2. From: michael@glia.biostr.washington.edu (Michael)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: How do you get enviroment variables?
  5. Message-ID: <michael.726192782@glia>
  6. Date: 5 Jan 93 00:13:02 GMT
  7. Article-I.D.: glia.michael.726192782
  8. References: <1993Jan3.194240.11140@exucom.com>
  9. Organization: University of Washington
  10. Lines: 22
  11. NNTP-Posting-Host: glia.biostr.washington.edu
  12.  
  13. In <1993Jan3.194240.11140@exucom.com> bobw@exucom.com (Bob Willer) writes:
  14. >How do you get the enviroment variables that are used by the system
  15. >with the SET command ie. in the autoexec.bat file ?
  16. >Bob Willer
  17.  
  18. Well, if you want the value of a single environment variable, you can
  19. always use the getenv() call.  If however you want to access the entire
  20. list of environment variables (or you don't know the name of one in
  21. particular and wish to search the entire list), then you can access the
  22. global variables 'environ' (in Borland C -- I assume Microsoft C has
  23. something similar).  Environ is of this type:
  24.  
  25.     extern char *environ[];
  26.  
  27. and is declared in <dos.h>.  Environ is a NULL terminated array of
  28. string pointers.  Each string is of the form:
  29.  
  30.     VAR=value
  31.  
  32. Hope that helps.
  33.  
  34.     Michael Stanley (michael@glia.biostr.washington.edu)
  35.