Function

GLibmarkup_printf_escaped

since: 2.4

Declaration

gchar*
g_markup_printf_escaped (
  const char* format,
  ...
)

Description

Formats arguments according to format, escaping all string and character arguments in the fashion of g_markup_escape_text(). This is useful when you want to insert literal strings into XML-style markup output, without having to worry that the strings might themselves contain markup.

const char *store = "Fortnum & Mason";
const char *item = "Tea";
char *output;

output = g_markup_printf_escaped ("<purchase>"
                                  "<store>%s</store>"
                                  "<item>%s</item>"
                                  "</purchase>",
                                  store, item);

Available since: 2.4

This function is not directly available to language bindings.

Parameters

format

Type: const char*

Printf() style format string.

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

Type: 

The arguments to insert in the format string.

Return value

Type: gchar*

Newly allocated result from formatting operation. Free with g_free().

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.