Function
GLibfile_set_contents
since: 2.8
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-
Type:
const gchar*Name of a file to write
contentsto, in the GLib file name encoding.The data is owned by the caller of the function. The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows. contents-
Type: An array of
guint8String to write to the file.
The length of the array is specified in the lengthargument.The data is owned by the caller of the function. length-
Type:
gssizeLength of
contents, or -1 ifcontentsis a nul-terminated string. error-
Type:
GError **The return location for a recoverable error.
The argument can be NULL.If the return location is not NULL, then you must initialize it to aNULLGError*.The argument will be left initialized to NULLby the function if there are no errors.In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.