This simple tutorial is for MS Visual C++. You remove an environment variable in C++ almost the same way you set it.
How to set environment variable?
char envName[256] = "Test";
SetEnvironmentVariable("VAR_NAME", envName);
How to remove environment variable? Setting the value to NULL literal deletes environment variable.
1.
2.
SetEnvironmentVariable("VAR_NAME", NULL);
How to get environment variable?
LPTSTR buffer1 = new TCHAR[256];
DWORD dwRet = GetEnvironmentVariable("VAR_NAME", buffer1, 256);
if (dwRet == 0)
{
// Environment variable does not exist
}