1

Possible Duplicate:
Questions about putenv() and setenv()

As we know,we can use function setenv and putenv to change environment variables.What are their differences? Do they need to allocate memory or not?

Thanks a lot.

Community
  • 1
  • 1
XiaJun
  • 1,855
  • 4
  • 24
  • 41

1 Answers1

0

From setenv's man page:

The setenv() function adds the variable name to the environment with the value value, if name does not already exist. If name does exist in the environment, then its value is changed to value if overwrite is nonzero; if overwrite is zero, then the value of name is not changed. This function makes copies of the strings pointed to by name and value (by contrast with putenv(3)).

Also, this.

Community
  • 1
  • 1
Alberto Miranda
  • 382
  • 6
  • 16