![]() |
![]() |
![]() |
![]() |
13 Environment Strings (env.hhf)
The ENV unit contains a couple of functions that fetch environment strings from the operating system. These functions can be used to test global values set by the user in the environment space inherited by your processes.
13.1 Retrieving Environment Strings
env.get( envVar:string; dest:string ); @returns( "eax" ); env.a_get( envVar:string ); @returns( "eax" );These functions return the string data associated with an environment variable whose name you pass as a parameter. The envVar parameter contains the name of the string to test in the environment space. These functions return the string (if any) associated with that name.
The env.get function copies the string data to the (preallocated) string variable you specify via the dest parameter. Note that the dest parameter must contain the address of a value HLA string object or this function may fail (or raise an exception). If the allocated storage isn't large enough to hold the string data, or the environment variable's string is greater than 4095 characters long, this function will raise an exception. This function returns true in EAX if it locates the environment variable in the environment space and successfully returns the environment variable's data. This function returns false in EAX if it cannot locate the environment variable in the environment space.
The env.a_get function also returns the value of an environment variable; however, it allocates storage for the result and returns a pointer to the string result (on the heap) in the EAX register, if such an environment variable exists. This function returns NULL in EAX if the environment variable does not exist. This function raises an exception if the environment variable's data is greater than 4095 characters long.
![]() |
![]() |
![]() |
![]() |
![]() |