Function

GLibmarkup_printf_escaped

Declaration [src]

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

Description [src]

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

Parameters

format const char*
 

Printf() style format string.

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

The arguments to insert in the format string.

Return value

Returns: 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 string is a NUL terminated UTF-8 string.