unsetenv

Removes an environment variable with its value.

Library:LibC
Classification:ANSI
Service:Environment Variable

Syntax

  #include <stdlib.h> 
   
  int unsetenv (
     const char   *name); 
  

Parameters

name

(IN) Points to the name of an environment variable.

Return Values

If successful, returns 0. Otherwise, returns -1, leaves the environment unchanged, and sets errno to the following:

Decimal

Constant

Description

9

EINVAL

The name parameter is invalid.

77

ESRCH

The environment variable was not found.

105

ENOCONTEXT

No thread context is present.

See Also