Method

GLibIOChannelread_line

Declaration

GIOStatus
g_io_channel_read_line (
  GIOChannel* channel,
  gchar** str_return,
  gsize* length,
  gsize* terminator_pos,
  GError** error
)

Description

Reads a line, including the terminating character(s), from a GIOChannel into a newly-allocated string. str_return will contain allocated memory if the return is G_IO_STATUS_NORMAL.

Parameters

str_return

Type: gchar**

The line read from the GIOChannel, including the line terminator. This data should be freed with g_free() when no longer needed. This is a nul-terminated string. If a length of zero is returned, this will be NULL instead.

The argument will be set by the function.
The instance takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.
length

Type: gsize*

Location to store length of the read data, or NULL.

The argument will be set by the function.
The argument can be NULL.
terminator_pos

Type: gsize*

Location to store position of line terminator, or NULL.

The argument will be set by the function.
The argument can be NULL.
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 a NULL GError*.
The argument will left initialized to NULL by the method 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.

Return value

Type: GIOStatus

The status of the operation.