环境变量
environ- 用户环境,一个全局变量。头文件<unistd.h>。可以通过man environ查看手册。1
2
3
4
5
6
7
8
9
10
using namespace std;
int main() {
cout << "program environment: " << endl;
for (char** entry = environ; *entry; ++entry) {
cout << *entry << endl;
}
}getenv- 获取环境变量。头文件<stdlib.h>。setenv- 设置环境变量。头文件stdlib.h。