Function

GLibbase64_decode

since: 2.12

Declaration

guchar*
g_base64_decode (
  const gchar* text,
  gsize* out_len
)

Description

Decode a sequence of Base-64 encoded text into binary data. Note that the returned binary data is not necessarily zero-terminated, so it should not be used as a character string.

Available since: 2.12

Parameters

text

Type: const gchar*

Zero-terminated string with base64 text to decode.

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

Type: gsize*

The length of the decoded data is written here.

The argument will be set by the function.

Return value

Type: An array of guint8

          newly allocated buffer containing the binary data
          that `text` represents. The returned buffer must
          be freed with g_free().
The length of the array is in the out_len argument.
The caller of the function takes ownership of the data, and is responsible for freeing it.