setenv - change or add an environment variable
SYNOPSIS
#include <stdlib.h>
int setenv(const char *name, const char *value, int overwrite);
int unsetenv(const char *name);
getenv()讀取環境變量的當前值的函數
原形:char *getenv(const char *name)
用法:s=getenv("環境變量名");
需先定義char *s;
功能:返回一給定的環境變量值,環境變量名可大寫或小寫。如果指定的變量在環境中未定義,則返回一空串。
頭文件:stdlib.h
eg:
String strEnv ="";
strEnv = getenv( "TMP_DIR");
if( ( NULL == strEnv ) || ( 0 == strlen(strEnv ) ) )
{
//error
}