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 = "Test";
How to remove environment variable? Setting the value to NULL literal deletes environment variable.
How to get environment variable?
LPTSTR buffer1 = new TCHAR;
DWORD dwRet = GetEnvironmentVariable("VAR_NAME", buffer1, 256);
if (dwRet == 0)
// Environment variable does not exist