GLib.strdup
Description: Reference for GLib.strdup

### Function

# GLibstrdup

since: 2.0

#### Declaration

    gchar*
    g_strdup (
      const gchar* str
    )

#### Description

Duplicates a string. If `str` is `NULL` it returns `NULL`.

Available since: 2.0

#### Parameters

`str`

  Type: `const gchar*`

  The string to duplicate.

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

#### Return value

Type: `gchar*`

A newly-allocated copy of `str`.

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