char *getenv(const char *varname);
头文件 stdlib.h
C库函数有,Qt不用什么东西都要封装一下吧.
下面是VC2008下的示例代码:
#include "stdafx.h"
#include "stdlib.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "PATH=" << getenv("PATH") << std::endl;
std::cout << "windir=" << getenv("windir") << std::endl;
system("pause");
return 0;
}