标签:des style blog color io for 2014 ar
/* *@author cody *@date 2014-08-12 *@description */ /* extern char **environ //environment values #include <stdlib.h> char *getenv(const char *name); int setenv(const char *name,const char *value,int rewrite); // set enviroment if exists rewrite - 0 do not rewrite not 0 rewrite void unsetenv(const char *name); //delete env by name */ #include <stdio.h> #include <stdlib.h> void environment(){ extern char **environ; int i; for(i = 0;environ[i] != NULL;i ++){ printf("%s\n",environ[i] ); } } void getPath(){ char *path = getenv("PATH"); printf("PATH = %s\n",path ); setenv("PATH","HELLO",1); path = getenv("PATH"); printf("PATH = %s\n",path ); } int main(int argc, char const *argv[]) { //environment(); getPath(); return 0; }
标签:des style blog color io for 2014 ar
原文地址:http://www.cnblogs.com/cody1988/p/3907257.html