### Function

# GLib strlcat

since: 2.0

#### Declaration

    gsize
    g_strlcat (
      gchar* dest,
      const gchar* src,
      gsize dest_size
    )

#### Description

Portability wrapper that calls `strlcat()` on systems which have it, and emulates it otherwise. Appends nul-terminated `src` string to `dest`, guaranteeing nul-termination for `dest`. The total size of `dest` won’t exceed `dest_size`.

At most `dest_size` - 1 characters will be copied. Unlike `strncat()`, `dest_size` is the full size of dest, not the space left over. This function does not allocate memory. It always nul-terminates (unless `dest_size` == 0 or there were no nul characters in the `dest_size` characters of dest to start with).

Caveat: this is supposedly a more secure alternative to `strcat()` or `strncat()`, but for real security `g_strconcat()` is harder to mess up.

Available since: 2.0

#### Parameters

`dest`

  Type: `gchar*`

  Destination buffer, already containing one nul-terminated string.

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

`src`

  Type: `const gchar*`

  Source buffer.

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

`dest_size`

  Type: `gsize`

  Length of `dest` buffer in bytes (not length of existing string inside `dest`)

#### Return value

Type: `gsize`

Size of attempted result, which is `MIN (dest_size, strlen (original dest)) + strlen (src)`, so if `retval` >= `dest_size`, truncation occurred.