Navigation:  Programming Cookbook > Creating Console Applications >

Accessing Environment Variables

Previous pageReturn to chapter overviewNext page

Environment variables are frequently used in conjunction with command line applications, and can be read as using the getenv() function of the CRT. For example:

CRTLibrary default getenv: 'TZ'


The result is a String (in this case the name of the current timezone).

New environment variables can be added, the value of existing variables changed, or variable removed, using the _putenv() function.

CRTLibrary default _putenv: 'Dolphin=Cool'.

CRTLibrary default getenv: 'Dolphin'


See Microsoft's documentation for further details of _putenv().