dup_bytestring


Description:

[ Version ( since = "2.26" ) ]
public string dup_bytestring (out size_t length)

Similar to get_bytestring except that instead of returning a constant string, the string is duplicated.

The return value must be freed using g_free.

Example: Get a copy of the byte string:

public static int main (string[] args) {
Variant var1 = new Variant.bytestring ("Hello, world!");
size_t length = 0;

// Output: ``'Hello, world!', 13``
print ("'%s', %"+size_t.FORMAT+"\n", var1.dup_bytestring (out length), length);

return 0;
}

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

Parameters:

this

an array-of-bytes Variant instance

length

a pointer to a size_t, to store the length (not including the nul terminator)

Returns:

a newly allocated string