Function

GLibByteArraynew_take

Declaration

GByteArray*
g_byte_array_new_take (
  guint8* data,
  gsize len
)

Description

Create byte array containing the data. The data will be owned by the array and will be freed with g_free(), i.e. it could be allocated using g_strdup().

Do not use it if len is greater than G_MAXUINT. GByteArray stores the length of its data in #guint, which may be shorter than

gsize.

Available since:2.32

Parameters

data An array of guint8
 

Byte data for the array.

 The length of the array is specified in the len argument.
 The called function takes ownership of the data, and is responsible for freeing it.
len gsize
 

Length of data.

Return value

Returns: An array of guint8
 

A new GByteArray.

 The caller of the function takes ownership of the data, and is responsible for freeing it.