CA Service Management

 View Only

CA SDM::.SPEL::. Getenv 

Jan 25, 2017 07:16 AM

Getenv

 

Overview

Gets the value of an environment variable

 

Method to return a string within a environment variable.

string getenv(string str)

It can be used to retrieve a variable that has been previously stored by the setenv function.
A variable defined at run time with the setenv function can be accessed at any time inside or outside the context of the function.

Usage

getenv ("string")

Examples

  • Getting the value of the PATH environment variable and putting it into the variable "result".
string result; result = getenv("Path");

setenv("myVar", "myValue"); // Store 'myvalue' in environment variable 'myVar'
printf("%s\n", getenv("myVar")); // Returns 'myValue'
printf("%s\n", getenv("COMPUTERNAME")); // Returns computer name 'SERVERSDM1'
printf("%s\n", getenv("NX_ROOT")); // Returns $NX_ROOT path

Results

This func will return the string value of the environment variable defined informed in string.

 

Getenv - SDU 

 

Daniel Bighelini 

Statistics
0 Favorited
8 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Mar 15, 2017 08:20 AM

Related Entries and Links

No Related Resource entered.