Method

GLibKeyFileget_comment

Declaration

gchar*
g_key_file_get_comment (
  GKeyFile* key_file,
  const gchar* group_name,
  const gchar* key,
  GError** error
)

Description

Retrieves a comment above key from group_name. If key is NULL then comment will be read from above group_name. If both key and group_name are NULL, then comment will be read from above the first group in the file.

Note that the returned string does not include the ‘#’ comment markers, but does include any whitespace after them (on each line). It includes the line breaks between lines, but does not include the final line break.

Available since:2.6

Parameters

group_name const gchar*
 

A group name, or NULL.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
key const gchar*
 

A key.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: utf8
 

A comment that should be freed with g_free()

 The caller of the method takes ownership of the data, and is responsible for freeing it.
 The string is a NUL terminated UTF-8 string.