### Function

# GLib listenv

since: 2.8

#### Declaration [src]

    gchar**
    g_listenv (
      void
    )

#### Description [src]

Gets the names of all variables set in the environment.

Programs that want to be portable to Windows should typically use this function and `g_getenv()` instead of using the environ array from the C library directly. On Windows, the strings in the environ array are in system codepage encoding, while in most of the typical use cases for environment variables in GLib-using programs you want the UTF-8 encoding that this function and `g_getenv()` provide.

Available since: 2.8

#### Return value

Type: An array of `filename`

    a `NULL`-terminated list of strings which must be freed with
    g_strfreev().

The array is `NULL`-terminated.
The caller of the function takes ownership of the data, and is responsible for freeing it.
Each element is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.