linux下c语言环境变量操作的几个相关函数

来源:互联网 发布:万达产业bcg矩阵分析 编辑:程序博客网 时间:2024/04/29 14:03

这几个函数的原型在<stdio.h>中定义

/* Return the value of envariable NAME, or NULL if it doesn't exist.  */
extern char *getenv (__const char *__name) __THROW __nonnull ((1)) __wur;

/* The SVID says this is in <stdio.h>, but this seems a better place.    */
/* Put STRING, which is of the form "NAME=VALUE", in the environment.
   If there is no `=', remove NAME from the environment.  */
extern int putenv (char *__string) __THROW __nonnull ((1));

/* Set NAME to VALUE in the environment.
   If REPLACE is nonzero, overwrite an existing value.  */
extern int setenv (__const char *__name, __const char *__value, int __replace)
     __THROW __nonnull ((2));

/* Remove the variable NAME from the environment.  */
extern int unsetenv (__const char *__name) __THROW __nonnull ((1));