Function

GLibstrdup

Declaration

gchar*
g_strdup (
  const gchar* str
)

Description

Duplicates a string. If str is NULL it returns NULL. The returned string should be freed with g_free() when no longer needed.

Parameters

str const gchar*
 

The string to duplicate.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.

Return value

Returns: gchar*
 

A newly-allocated copy of str.

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