GetEnv()
This function returns the value of a DOS environment variable.
Usage | cValue = GETENV( cVarName ) |
Use GETENV() to find information like the DOS path, the directory in which Windows is installed, and so forth. On a network, there are likely to be variables containing information about the network configuration. You can also create environment variables for your own purposes in AUTOEXEC.BAT and query them with GETENV(). You might set up your development machine with a variable, DEVMODE, set to "YES" and use that value to trigger certain behavior in your apps (debugging behaviors, for example). When the variable you specify doesn't exist, GETENV() returns the empty string. This is both a good thing and a bad thing. It's good because it makes schemes like the one above work—your users don't have to have a DEVMODE variable. It's bad because it makes it easy to make typos. The moral of the story is that you need to double-check GETENV() calls—in fact, test them in the command window first.
Example | cCurDOSPath = GETENV("Path") |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.