SetEnvironmentVariable

 

Description

This function sets the value of an environment variable for the current process.

Syntax

BOOL SetEnvironmentVariable( LPCSTR lpcszName, LPCSTR lpcszValue )

Parameters

lpcszName
environment variable name
lpcszValue
new value for environment variable

Return

TRUE for success

Examples

EX1

// usage:
// set_environment_str test "A new string for testing";
// show_environment_str test;
void SetEnvironmentVariable_ex1(string strName, string strValue)
{
    if(SetEnvironmentVariable(strName, strValue))
        return;
    out_str("error calling SetEnvironmentVariable");
}

Remark

See Also

GetEnvironmentVariable

header to Include

origin.h

Reference