i try to do a simple task and get environment variable both in Linux and windows all docs point to use : std::getenv but when i run the compilation in windows 10 using visual studio 2019 I'm getting :
error C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS
This is the function :
std::string Utils::getEnvVar(std::string const& key)
{
char* val = std::getenv(key.c_str());
return val == NULL ? std::string("") : std::string(val);
}
i found only this thread , which i don't understand what is the solution for cross-platform solution.