Method
GLibOptionContextparse_strv
since: 2.40
Declaration [src]
gboolean
g_option_context_parse_strv (
GOptionContext* context,
gchar*** arguments,
GError** error
)
Description [src]
Parses the command line arguments.
This function is similar to g_option_context_parse()
except that it
respects the normal memory rules when dealing with a strv instead of
assuming that the passed-in array is the argv of the main function.
In particular, strings that are removed from the arguments list will be freed using g_free().
On Windows, the strings are expected to be in UTF-8. This is in
contrast to g_option_context_parse()
which expects them to be in the
system codepage, which is how they are passed as argv
to main().
See g_win32_get_command_line()
for a solution.
This function is useful if you are trying to use GOptionContext
with
GApplication
.
Available since: 2.40
Parameters
arguments
-
Type: An array of
gchar**
A pointer to the command line arguments (which must be in UTF-8 on Windows). Starting with GLib 2.62,
arguments
can beNULL
, which matches g_option_context_parse().The argument will be modified by the function. The argument can be NULL
.The array must be NULL
-terminated.The caller of the method takes ownership of the returned data, and is responsible for freeing it. Each element is a NUL terminated UTF-8 string. error
-
Type:
GError **
The return location for a recoverable error.
The argument can be NULL
.If the return location is not NULL
, then you must initialize it to aNULL
GError*
.The argument will be left initialized to NULL
by the method if there are no errors.In case of error, the argument will be set to a newly allocated GError
; the caller will take ownership of the data, and be responsible for freeing it.