setenv

Inserts or resets the environment variable name in the current environment list.

Format

#include  <stdlib.h>

int setenv  (const char *name, const char *value,
            int overwrite);

Arguments

name
A variable name in the environment variable list.
value
The value for the environment variable.
overwrite
A value of 0 or 1 indicating whether to reset the environment variable, if it exists.

Description

This function inserts or resets the environment variable name in the current environment list. If the variable name does not exist in the list, it is inserted with the value argument. If the variable does exist, the overwrite argument is tested. When the overwrite argument value is:

Return Values
Indicates success. 
-1  Indicates an error. errno is set to ENOMEM-Not enough memory available to expand the environment list. 


Previous Page | Next Page | Table of Contents | Index