[][src]Function qt_core::qgetenv

pub unsafe fn qgetenv(
    var_name: impl CastInto<Ptr<c_char>>
) -> CppBox<QByteArray>

Returns the value of the environment variable with name varName. To get the variable string, use QByteArray::constData(). To convert the data to a QString use QString::fromLocal8Bit().

Calls C++ function: QByteArray qgetenv(const char* varName).

C++ documentation:

Returns the value of the environment variable with name varName. To get the variable string, use QByteArray::constData(). To convert the data to a QString use QString::fromLocal8Bit().

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

Warning: Don't use qgetenv on Windows if the content may contain non-US-ASCII characters, like file paths.

See also qputenv(), qEnvironmentVariableIsSet(), and qEnvironmentVariableIsEmpty().