since: 2.28


g_application_command_line_get_arguments (
  GApplicationCommandLine* cmdline,
  int* argc


Gets the list of arguments that was passed on the command line.

The strings in the array may contain non-UTF-8 data on UNIX (such as filenames or arguments given in the system locale) but are always in UTF-8 on Windows.

If you wish to use the return value with GOptionContext, you must use g_option_context_parse_strv().

The return value is NULL-terminated and should be freed using g_strfreev().

Available since: 2.28



Type: int*

The length of the arguments array, or NULL.

The argument will be set by the function.
The argument can be NULL.

Return value

Type: An array of filename

 the string array containing the arguments (the argv)

The length of the array is in the argc argument.
The caller of the method takes ownership of the data, and is responsible for freeing it.
Each element is a file system path, using the OS encoding.