list_variables


Description:

[ Version ( since = "2.8" ) ]
public string[] list_variables ()

Gets the names of all variables set in the environment.

Programs that want to be portable to Windows should typically use this function and get_variable 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 get_variable provide.

Example: Get the names of all variables set in the environment:

public static int main () {
// Local Output:
// ``SSH_AGENT_PID``
// ``PATH``
// ...
string[] args = Environment.list_variables ();
foreach (string arg in args) {
print ("%s\n", arg);
}
return 0;
}

valac --pkg glib-2.0 GLib.Environment.list_variables.vala

Returns:

a null-terminated list of strings which must be freed with strfreev.


Namespace: GLib.Environment
Package: glib-2.0