Command Prompt for Windows




putenvironment, _wputenvironment, _tputenvironment

int putenvironment(char *name);
int _wputenvironment(wchar_t *name);
int _tputenvironment(TCHAR *name);

Place an environment string into the WinOne® Command Prompt environment space.

Parameter Description
name Address of a NULL terminated character string that contains the environment string to place into the WinOne® Command Prompt environment space.

Returns

Value of zero. On error, a value of -1 is returned

Comments

The parameter name is duplicated using malloc() by the WinOne® Command Prompt and therefore, does not need to be a static or malloced and not freed, which is the case with the standard library function putenv().

Environment strings have the form:-

VARNAME=ENVSTRING

To delete an environment variable, exclude the ENVSTRING. For example, to delete the environment variable AVAR :-

putenvironment("AVAR=");

See Also

getenvironment