### Method

# GLib Variant dup_string

since: 2.24

#### Declaration

    gchar*
    g_variant_dup_string (
      GVariant* value,
      gsize* length
    )

#### Description

Similar to `g_variant_get_string()` except that instead of returning a constant string, the string is duplicated.

The string will always be UTF-8 encoded.

The return value must be freed using g_free().

Available since: 2.24

#### Parameters

`length`

  Type: `gsize*`

  A pointer to a #gsize, to store the length.

  The argument will be set by the function.

#### Return value

Type: `gchar*`

A newly allocated string, UTF-8 encoded.

The caller of the method takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.