Function

GLibenviron_setenv

Declaration [src]

gchar**
g_environ_setenv (
  gchar** envp,
  const gchar* variable,
  const gchar* value,
  gboolean overwrite
)

Description [src]

Sets the environment variable variable in the provided list envp to value.

Available since:2.32

Parameters

envp An array of filename
 
an environment list that can be freed using `g_strfreev()` (e.g., as
returned from `g_get_environ()`), or `NULL` for an empty
environment list.
 The argument can be NULL.
 The called function takes ownership of the data, and is responsible for freeing it.
variable const gchar*
 

The environment variable to set, must not contain ‘=’

 The data is owned by the caller of the function.
 The string is a file system path, using the OS encoding.
value const gchar*
 

The value for to set the variable to.

 The data is owned by the caller of the function.
 The string is a file system path, using the OS encoding.
overwrite gboolean
 

Whether to change the variable if it already exists.

Return value

Returns: An array of filename
 
the updated environment list. Free it using `g_strfreev()`.
 The caller of the function takes ownership of the data, and is responsible for freeing it.