Qore Programming Language Reference Manual  1.0.10
Environment Functions

Environment functions. More...

Functions

*string Qore::getenv (string var)
 Retrieves the value of an environment variable or NOTHING if the variable is not set. More...
 
nothing Qore::getenv ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::setenv (string env, softstring val)
 Sets an environment variable to a value. More...
 
nothing Qore::setenv ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
int Qore::unsetenv (string env)
 Unsets an environment variable. More...
 
nothing Qore::unsetenv ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 

Detailed Description

Environment functions.

Function Documentation

◆ getenv() [1/2]

nothing Qore::getenv ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Restrictions:
Qore::PO_NO_EXTERNAL_INFO
Code Flags:
NOOP

◆ getenv() [2/2]

*string Qore::getenv ( string  var)

Retrieves the value of an environment variable or NOTHING if the variable is not set.

Restrictions:
Qore::PO_NO_EXTERNAL_INFO
Code Flags:
CONSTANT
Parameters
varthe name of the environment variable
Returns
the value of an environment variable or NOTHING if the variable is not set
Example:
*string v = getenv("PATH");
Since
Qore 0.8.4 tagged with PO_NO_EXTERNAL_INFO

◆ setenv() [1/2]

nothing Qore::setenv ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Restrictions:
Qore::PO_NO_PROCESS_CONTROL
Code Flags:
NOOP

◆ setenv() [2/2]

int Qore::setenv ( string  env,
softstring  val 
)

Sets an environment variable to a value.

Restrictions:
Qore::PO_NO_PROCESS_CONTROL
Parameters
envthe name of the environment variable
valthe new value of the environment variable
Returns
-1 for error or 0 for success; if an error occurs, errno() and/or strerror() can be used to get the error code or message
Example:
if (setenv("PATH", "/bin:/usr/bin"))
printf("error setting PATH: %s\n", strerror());
See also
unsetenv() to unset or clear an environment variable
Since
Qore 0.8.4 tagged with PO_NO_PROCESS

◆ unsetenv() [1/2]

nothing Qore::unsetenv ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Restrictions:
Qore::PO_NO_EXTERNAL_INFO
Code Flags:
NOOP

◆ unsetenv() [2/2]

int Qore::unsetenv ( string  env)

Unsets an environment variable.

Restrictions:
Qore::PO_NO_PROCESS_CONTROL
Parameters
envthe name of the environment variable to unset
Returns
-1 for error or 0 for success; if an error occurs, errno() and/or strerror() can be used to get the error code or message
Example:
if (unsetenv("PATH"))
printf("error unsetting PATH: %s\n", strerror());
See also
setenv() to set an environment variable to a value
Since
Qore 0.8.4 tagged with PO_NO_PROCESS
Qore::unsetenv
int unsetenv(string env)
Unsets an environment variable.
Qore::getenv
*string getenv(string var)
Retrieves the value of an environment variable or NOTHING if the variable is not set.
Qore::setenv
int setenv(string env, softstring val)
Sets an environment variable to a value.
Qore::printf
string printf(string fmt,...)
Outputs the string passed to standard output, using the first argument as a format string; does not e...