CA SDM::.SPEL::. getenv

Document created by Daniel Becker Bighelini Champion on Feb 23, 2017Last modified by Daniel Becker Bighelini Champion on Feb 23, 2017
Version 2Show Document
  • View in full screen mode


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.


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
3 people found this helpful