Clib.getenv()
syntax: |
Clib.getenv([variableName]) |
where: |
variableName - the name of an environment variable.
|
return: |
string - a string representation of the value of an environment variable on success. If no variableName is passed, an array of all environment variable names. On failure, returns null.
|
description: |
If the parameter variableName is supplied, this method returns the value of a similarly named environment variable as a string, if the variable exists, and null if VariableName does not exist. If no name is supplied. then it returns an array of all environment variable names, ending with a null element.
|
see: |
|
example: |
// Print the existing environment variables, // in "EVAR=Value" format, // sorted alphabetically.
// get array of all environment variable names var EnvList = Clib.getenv(); // sort array alphabetically Clib.qsort(EnvList, getArrayLength(EnvList), Clib.stricmp); // display each element in ENV=VALUE format for ( var lIdx = 0; EnvList[lIdx]; lIdx++ ) Clib.printf("%s=%s\n", EnvList[lIdx], Clib.getenv(EnvList[lIdx])); |