getenv

Searches the environment area for the environment variable and returns the environment variable’s value.

Library:LibC
Classification:ANSI
Service:Environment Variable

Syntax

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

Parameters

name

(IN) Points to an environment variable.

Return Values

If successful, returns a pointer to the string assigned to the environment variable. If no match was found, returns a NULL pointer and sets errno to one of the following:

Decimal

Constant

Description

77

ESRCH

No such variable.

105

ENOCONTEXT

No thread context is present.

Remarks

The matching is case-insensitive; all lowercase letters are treated as if they were uppercase.

See Also