[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


getenv

Environment list access.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <stdlib.h>
char *getenv(char *name);
Parameters:

Parameters for this facility are:

name  
char *  
A buffer for the environment list  

Remarks:

For Macintosh systems the getenv() is an empty function that always returns a null pointer (NULL). It is included in the Metrowerks stdlib.h header file to conform to the ANSI C Standard Library specification.

Return:

getenv() returns NULL for the Mac. For Windows getenv() returns zero on failure or the environmental variable.

See Also:

"system"

Example of getenv() usage::
#include <stdio.h>
#include <stdlib.h>

int main(void) 
{
	char *value;
	char *var = "path";

	if( (value = getenv(var)) == NULL)
	{ printf("%s is not a environmental variable", var);}
	else
	{ printf("%s = %s \n", var, value);}

	return 0;
}

Result:
path = c:\program files\metrowerks\codewarrior;c:\WINNT\system32


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000