xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

GetEnv()

Retrieves an operating system environment variable.

Syntax

GetEnv( <cEnvVar> ) --> cString

Arguments

<cEnvVar>
A character string with the name of the environment variable to retrieve. The name is not case-sensitive.

Return

The function returns the contents of the environment variable <cEnvVar> as a character string, or a null string ("") when the environment variable does not exist.

Description

The GetEnv() function queries the environment variables defined for the operating system command shell that has started the xHarbour application. Environment variables are defined using the SET command of the command shell.

Info

See also:CurDir(), CurDrive(), File(), SET DEFAULT, SET PATH
Category: Environment functions
Source:rtl\gete.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example retrieves some environment variables common for
// a programming environment:

   PROCEDURE Main
      ? GetEnv( "INCLUDE" )           // SET INCLUDE=path

      ? GetEnv( "LIB" )               // SET LIB=path

      ? GetEnv( "COMSPEC" )           // Command shell
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe