I need to write a unit test for some C++ code that checks for the presence of an environmental variable. I’m using MSVS 2008 and gtest as my framework. I add the environmental variable using putenv, I check the environmental variable using getevn, but I can’t figure out how to remove it so that no other test will see it. I realize this is probably easy, but I can’t find the answer on the internet. Thanks
Share
Calling
putenvagain specifying"SOME_VAR="as parameter will delete environment variableSOME_VAR. btw, Microsoft recommends using_putenvasputenvis deprecated.