dup_strv


Description:

[ CCode ( array_length_type = "gsize" ) ]
public string[] dup_strv ()

Gets the contents of an array of strings Variant.

This call makes a deep copy; the return result should be released with strfreev.

If return.length is non-null then the number of elements in the result is stored there. In any case, the resulting array will be null-terminated.

For an empty array, return.length will be set to 0 and a pointer to a null pointer will be returned.

Example: Get a copy of the string array:

public static int main () {
Variant var1 = new Variant.strv ({"a", "b", "c"});
// Output: ``a,b,c``
print ("%s\n", string.joinv (",", var1.dup_strv ()));
// Output: ``a,b,c``
print ("%s\n", string.joinv (",", var1.get_strv ()));
// Output: ``a,b,c``
print ("%s\n", string.joinv (",", (string[]) var1));
return 0;
}

valac --pkg glib-2.0 GLib.Variant.dup_strv.vala

Parameters:

this

an array of strings Variant

length

the length of the result, or null

Returns:

an array of strings