Function

GLibfile_set_contents

Declaration

gboolean
g_file_set_contents (
  const gchar* filename,
  const gchar* contents,
  gssize length,
  GError** error
)

Description

Writes all of contents to a file named filename. This is a convenience wrapper around calling g_file_set_contents_full() with flags set to G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING and mode set to 0666.

Available since:2.8

Parameters

filename const gchar*
 

Name of a file to write contents to, in the GLib file name encoding.

 The data is owned by the caller of the function.
 The string is a file system path, using the OS encoding.
contents An array of guint8
 

String to write to the file.

 The length of the array is specified in the length argument.
 The data is owned by the caller of the function.
length gssize
 

Length of contents, or -1 if contents is a nul-terminated string.

error GError **
  The return location for a GError*, or NULL.

Return value

Returns: gboolean
 

TRUE on success, FALSE if an error occurred.