#include <stdio.h> #include <stdlib.h> #include <alloc.h> #include <string.h> #include <dos.h> int main(void) { char *path, *ptr; int i = 0; /* get the current path environment */ ptr = getenv("PATH"); /* set up new path */ path = malloc(strlen(ptr)+15); strcpy(path,"PATH="); strcat(path,ptr); strcat(path,";c:\\temp"); /* replace the current path and display current environment */ putenv(path); while (environ[i]) printf("%s\n",environ[i++]); return 0; }
by: 发表于:2017-08-24 17:40:48 顶(0) | 踩(0) 回复
??
回复评论