putenv.3

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 72 行

3
72
字号
.\" SCCSID: @(#)putenv.3	8.1	9/11/90.TH putenv 3.SH Nameputenv \- change or add value to environment .SH Syntax.B int putenv (string).br.B char \(**string;.SH Description.NXR "putenv subroutine".NXA "getenv subroutine (standard C)" "putenv subroutine".NXR "environment" "changing"The.I string\^points to a string of the form.IB ``name = value.''The.PN putenvsubroutine makes the value of the environment variable.I name\^equal to.I value\^by altering an existing variable or creating a new one.In either case, the string pointed to by.I string\^becomes part of theenvironment, so altering the string will change the environment.The space used by.I string\^is no longer used once a new string-defining.I name\^is passed to.PN putenv ..SH DiagnosticsThe.PN putenvsubroutine returns nonzero if it was unable to obtain enough spacevia .PN mallocfor an expanded environment, otherwise zero..SH WarningsThe .PN putenvsubroutine manipulates the environment pointed to by .PN environ ,and can be used in conjunction with .PN getenv .However,.I envp(the third argument to .IR main ) is not changed..brThis routine uses .MS malloc 3to enlarge the environment..brAfter.PN putenvis called, environmental variables are not inalphabetical order..brA potential error is to call.PN putenvwith an automatic variableas the argument, then exit the calling function while.I string\^is still part of the environment..SH See Alsoexecve(2), getenv(3), malloc(3), environ(7)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?