getenv()                 Get a Value from the Environment Table
 
 #include   <stdlib.h>
 
 char       *getenv(varname);
 char       *varname;                    Name of environment variable
 
    getenv() searches the list of environment variables for an entry
    corresponding to 'varname'.
 
    Returns:    A pointer to the environment table containing the current
                string value of 'varname'.  NULL is returned if 'varname'
                is not currently defined.
 
      Notes:    Entries can be changed using putenv().  Use strdup() or
                strcpy() to modify the returned value without affecting
                the environment table.
 
  -------------------------------- Example ---------------------------------
 
    The following statements get some environment settings and print them
    out.
 
            #include <stdlib.h>
            char *pathvar, *libvar;
 
            main()
            {
                pathvar = getenv("PATH"); /* NULL if no PATH */
                libvar = getenv("LIB");   /* NULL if no LIB setting */
                printf("PATH AND LIB ENVIRONMENT SETTINGS\n");
                printf("\tPATH: %s\n",pathvar);
                printf("\tINCLUDE: %s\n",inclvar);
            }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster