#include
#include // 包含获取环境变量所需的头文件
int main() {
// 要获取的环境变量的名称
const char* envVarName = "MY_ENV_VARIABLE";
// 使用std::getenv获取环境变量的值
const char* envVarValue = std::getenv(envVarName);
if (envVarValue != nullptr) {
std::cout << "Environment variable " << envVarName << " has value: " << envVarValue << std::endl;
} else {
std::cerr << "Environment variable " << envVarName << " is not defined." << std::endl;
}
return 0;
}