Function

GLibStringnew_len

Declaration

GString*
g_string_new_len (
  const gchar* init,
  gssize len
)

Description

Creates a new GString with len bytes of the init buffer. Because a length is provided, init need not be nul-terminated, and can contain embedded nul bytes.

Since this function does not stop at nul bytes, it is the caller’s responsibility to ensure that init has at least len addressable bytes.

Parameters

init

Type: const gchar*

Initial contents of the string.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
len

Type: gssize

Length of init to use.

Return value

Type: GString

A new GString.

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