dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosScanEnv (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSMISC
 
USHORT DosScanEnv(pszVarName, ppszResult)
PSZ pszVarName;          /* pointer to environment-variable name   */
PSZ FAR * ppszResult;    /* pointer to variable for result pointer */
 
The DosScanEnv function searches an environment for a specified environment
variable. The environment is one or more null-terminated strings that name
and define the environment variables available to the current process.
Environment variables can be used to pass information to a program──for
example, a variable might name a list of directories that contain data files
to be used by the program.
 
An environment variable has the following form:
 
name=value
 
The DosScanEnv function searches for the environment variable whose name
matches the name pointed to by the pszVarName parameter. If DosScanEnv finds
the variable, it copies the address of the first character of the
environment variable's value to the variable pointed to by the ppszResult
parameter. The first character of the environment variable's value is the
character following the equal sign (=).
 
Parameter   Description
────────────────────────────────────────────────────────────────────────────
 
pszVarName  Points to a null-terminated string that specifies the name of an
            environment variable. The string must not include a trailing
            equal sign (=), since the equal sign is not part of the name.
 
ppszResult  Points to the pointer variable that receives the address of the
            environment string.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be the following:
 
     ERROR_ENVVAR_NOT_FOUND
 
See Also
 
DosExecPgm, DosGetEnv, DosSearchPath