GetEnvironmentVariable
ExpandEnvironmentStrings 支护船体
SetEnvironmentVariable
系统的 hkey_local_machinesystemcurrentcontrolsetcontrolsettion managerenvironment
当前用户的 hkey_current_userenvironment
我把完整程序贴上来,有时间的话请在Turboc2里运行一下看看。
#include //"stdio.h
#include //"io.h//"
#include //"stdlib.h//"
main()
{
/*Define variables*/
int AccMode;
const char *EnvName = //"windir//";
char *EnvValue;
/*Assign default value*/
AccMode = -1;
EnvValue = getenv(EnvName);
/*Print Setup title*/
printf(//"Will setup .Net Framework...n//");
/*Detect if there is .Net Framework v1.41 installed*/
access(EnvValue,AccMode);
printf(//"AccMode is %dn//",AccMode);
printf(//"WINDIR is %s//",EnvValue);
if (AccMode==0)
printf(//"There is c:windows//");
}
ExpandEnvironmentStrings 支护船体
SetEnvironmentVariable
系统的 hkey_local_machinesystemcurrentcontrolsetcontrolsettion managerenvironment
当前用户的 hkey_current_userenvironment
我把完整程序贴上来,有时间的话请在Turboc2里运行一下看看。
#include //"stdio.h
#include //"io.h//"
#include //"stdlib.h//"
main()
{
/*Define variables*/
int AccMode;
const char *EnvName = //"windir//";
char *EnvValue;
/*Assign default value*/
AccMode = -1;
EnvValue = getenv(EnvName);
/*Print Setup title*/
printf(//"Will setup .Net Framework...n//");
/*Detect if there is .Net Framework v1.41 installed*/
access(EnvValue,AccMode);
printf(//"AccMode is %dn//",AccMode);
printf(//"WINDIR is %s//",EnvValue);
if (AccMode==0)
printf(//"There is c:windows//");
}