[][src]Function qt_core::qputenv

pub unsafe fn qputenv(
    var_name: impl CastInto<Ptr<c_char>>,
    value: impl CastInto<Ref<QByteArray>>
) -> bool

This function sets the value of the environment variable named varName. It will create the variable if it does not exist. It returns 0 if the variable could not be set.

Calls C++ function: bool qputenv(const char* varName, const QByteArray& value).

C++ documentation:

This function sets the value of the environment variable named varName. It will create the variable if it does not exist. It returns 0 if the variable could not be set.

Calling qputenv with an empty value removes the environment variable on Windows, and makes it set (but empty) on Unix. Prefer using qunsetenv() for fully portable behavior.

Note: qputenv() was introduced because putenv() from the standard C library was deprecated in VC2005 (and later versions). qputenv() uses the replacement function in VC, and calls the standard C library's implementation on all other platforms.

See also qgetenv().