Function

GLibIOChannelnew_file

Declaration

GIOChannel*
g_io_channel_new_file (
  const gchar* filename,
  const gchar* mode,
  GError** error
)

Description

Open a file filename as a GIOChannel using mode mode. This channel will be closed when the last reference to it is dropped, so there is no need to call g_io_channel_close() (though doing so will not cause problems, as long as no attempt is made to access the channel after it is closed).

Parameters

filename const gchar*
 

A string containing the name of a file.

 The data is owned by the caller of the function.
 The string is a file system path, using the OS encoding.
mode const gchar*
 

One of “r”, “w”, “a”, “r+”, “w+”, “a+”. These have the same meaning as in fopen()

 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: GIOChannel
 

A GIOChannel on success, NULL on failure.

 The caller of the function takes ownership of the data, and is responsible for freeing it.