### Function

# GLib strerror

#### Declaration [src]

    const gchar*
    g_strerror (
      gint errnum
    )

#### Description [src]

Returns a string corresponding to the given error code, e.g. “no such process”.

Unlike `strerror()`, this always returns a string in UTF-8 encoding, and the pointer is guaranteed to remain valid for the lifetime of the process. If the error code is unknown, it returns a string like “Unknown error <code>”.

Note that the string may be translated according to the current locale.

The value of `errno` will not be changed by this function. However, it may be changed by intermediate function calls, so you should save its value as soon as the call returns:

    int saved_errno;

    ret = read (blah);
    saved_errno = errno;

    g_strerror (saved_errno);

#### Parameters

`errnum`

  Type: `gint`

  The system error number. See the standard C `errno` documentation.

#### Return value

Type: `const gchar*`

The string describing the error code.

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