如何在 C++ 中设置环境变量?
谢谢
最佳答案
NAME putenv - change or add an environment variable SYNOPSIS #include <stdlib.h> int putenv(char *string); DESCRIPTION The putenv() function adds or changes the value of environment variables. The argument string is of the form name=value. If name does not already exist in the environment, then string is added to the environment. If name does exist, then the value of name in the environment is changed to value. The string pointed to by string becomes part of the environment, so altering the string changes the environment.
我相信在 Win32 上它被称为 _putenv。
见 SetEnvironmentVariable如果你喜欢又长又丑的函数名。
https://stackoverflow.com/questions/899517/