delorie.com/djgpp/doc/libc/libc_630.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <stdlib.h> int putenv(char *env); |
This function adds an entry to the program's environment. The string
passed must be of the form NAME
=VALUE
. Any existing value
for the environment variable is gone.
putenv
will copy the string passed to it, and will
automatically free any existing string already in the environment.
Keep this in mind if you alter the environment yourself. The string
you pass is still your responsibility to free. Note that most
implementations will not let you free the string you pass, resulting
in memory leaks.
Zero on success, nonzero on failure; errno
will be set to the
relevant error code: currently only ENOMEM
(insufficient memory)
is possible.
ANSI/ISO C | No |
POSIX | 1003.2-1992; 1003.1-2001 (see note 1) |
Notes:
putenv("SHELL=ksh.exe"); |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |