<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="glib-IO-Channels">
<refmeta>
<refentrytitle role="top_of_page" id="glib-IO-Channels.top_of_page">IO Channels</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>IO Channels</refname>
<refpurpose>portable support for using files, pipes and sockets</refpurpose>
</refnamediv>

<refsect1 id="glib-IO-Channels.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-io-channel-unix-new">g_io_channel_unix_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-unix-get-fd">g_io_channel_unix_get_fd</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-io-channel-win32-new-fd">g_io_channel_win32_new_fd</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-io-channel-win32-new-socket">g_io_channel_win32_new_socket</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-io-channel-win32-new-messages">g_io_channel_win32_new_messages</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-init">g_io_channel_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-io-channel-new-file">g_io_channel_new_file</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-read-chars">g_io_channel_read_chars</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-read-unichar">g_io_channel_read_unichar</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-read-line">g_io_channel_read_line</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-read-line-string">g_io_channel_read_line_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-read-to-end">g_io_channel_read_to_end</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-write-chars">g_io_channel_write_chars</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-write-unichar">g_io_channel_write_unichar</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-flush">g_io_channel_flush</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-seek-position">g_io_channel_seek_position</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-shutdown">g_io_channel_shutdown</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GIOChannelError"><returnvalue>GIOChannelError</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-error-from-errno">g_io_channel_error_from_errno</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-io-channel-ref">g_io_channel_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-unref">g_io_channel_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GSource"><returnvalue>GSource</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-io-create-watch">g_io_create_watch</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-add-watch">g_io_add_watch</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-add-watch-full">g_io_add_watch_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GIOFunc">*GIOFunc</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>


<row><entry role="function_type"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-get-buffer-size">g_io_channel_get_buffer_size</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-set-buffer-size">g_io_channel_set_buffer_size</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOCondition"><returnvalue>GIOCondition</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-get-buffer-condition">g_io_channel_get_buffer_condition</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOFlags"><returnvalue>GIOFlags</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-get-flags">g_io_channel_get_flags</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-set-flags">g_io_channel_set_flags</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-io-channel-get-line-term">g_io_channel_get_line_term</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-set-line-term">g_io_channel_set_line_term</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-get-buffered">g_io_channel_get_buffered</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-set-buffered">g_io_channel_set_buffered</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-io-channel-get-encoding">g_io_channel_get_encoding</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-set-encoding">g_io_channel_set_encoding</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-get-close-on-unref">g_io_channel_get_close_on_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-set-close-on-unref">g_io_channel_set_close_on_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GIOError"><returnvalue>GIOError</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-read">g_io_channel_read</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOError"><returnvalue>GIOError</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-write">g_io_channel_write</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GIOError"><returnvalue>GIOError</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-seek">g_io_channel_seek</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-io-channel-close">g_io_channel_close</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="glib-IO-Channels.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GIOChannel">GIOChannel</link></entry></row>



<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GSeekType">GSeekType</link></entry></row>

<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GIOStatus">GIOStatus</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GIOChannelError">GIOChannelError</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-IO-CHANNEL-ERROR:CAPS">G_IO_CHANNEL_ERROR</link></entry></row>


<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GIOCondition">GIOCondition</link></entry></row>

<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GIOFuncs">GIOFuncs</link></entry></row>

<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GIOFlags">GIOFlags</link></entry></row>

<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GIOError">GIOError</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 id="glib-IO-Channels.includes"><title>Includes</title><synopsis>#include &lt;glib.h&gt;
</synopsis></refsect1>

<refsect1 id="glib-IO-Channels.description" role="desc">
<title role="desc.title">Description</title>
<para>The <link linkend="GIOChannel"><type>GIOChannel</type></link> data type aims to provide a portable method for
using file descriptors, pipes, and sockets, and integrating them
into the <link linkend="glib-The-Main-Event-Loop">main event loop</link>. Currently,
full support is available on UNIX platforms, support for Windows
is only partially complete.</para>
<para>To create a new <link linkend="GIOChannel"><type>GIOChannel</type></link> on UNIX systems use
<link linkend="g-io-channel-unix-new"><function>g_io_channel_unix_new()</function></link>. This works for plain file descriptors,
pipes and sockets. Alternatively, a channel can be created for a
file in a system independent manner using <link linkend="g-io-channel-new-file"><function>g_io_channel_new_file()</function></link>.</para>
<para>Once a <link linkend="GIOChannel"><type>GIOChannel</type></link> has been created, it can be used in a generic
manner with the functions <link linkend="g-io-channel-read-chars"><function>g_io_channel_read_chars()</function></link>,
<link linkend="g-io-channel-write-chars"><function>g_io_channel_write_chars()</function></link>, <link linkend="g-io-channel-seek-position"><function>g_io_channel_seek_position()</function></link>, and
<link linkend="g-io-channel-shutdown"><function>g_io_channel_shutdown()</function></link>.</para>
<para>To add a <link linkend="GIOChannel"><type>GIOChannel</type></link> to the <link linkend="glib-The-Main-Event-Loop">main event loop</link>,
use <link linkend="g-io-add-watch"><function>g_io_add_watch()</function></link> or <link linkend="g-io-add-watch-full"><function>g_io_add_watch_full()</function></link>. Here you specify which
events you are interested in on the <link linkend="GIOChannel"><type>GIOChannel</type></link>, and provide a
function to be called whenever these events occur.</para>
<para><link linkend="GIOChannel"><type>GIOChannel</type></link> instances are created with an initial reference count of 1.
<link linkend="g-io-channel-ref"><function>g_io_channel_ref()</function></link> and <link linkend="g-io-channel-unref"><function>g_io_channel_unref()</function></link> can be used to
increment or decrement the reference count respectively. When the
reference count falls to 0, the <link linkend="GIOChannel"><type>GIOChannel</type></link> is freed. (Though it
isn't closed automatically, unless it was created using
<link linkend="g-io-channel-new-file"><function>g_io_channel_new_file()</function></link>.) Using <link linkend="g-io-add-watch"><function>g_io_add_watch()</function></link> or
<link linkend="g-io-add-watch-full"><function>g_io_add_watch_full()</function></link> increments a channel's reference count.</para>
<para>The new functions <link linkend="g-io-channel-read-chars"><function>g_io_channel_read_chars()</function></link>,
<link linkend="g-io-channel-read-line"><function>g_io_channel_read_line()</function></link>, <link linkend="g-io-channel-read-line-string"><function>g_io_channel_read_line_string()</function></link>,
<link linkend="g-io-channel-read-to-end"><function>g_io_channel_read_to_end()</function></link>, <link linkend="g-io-channel-write-chars"><function>g_io_channel_write_chars()</function></link>,
<link linkend="g-io-channel-seek-position"><function>g_io_channel_seek_position()</function></link>, and <link linkend="g-io-channel-flush"><function>g_io_channel_flush()</function></link> should not be
mixed with the deprecated functions <link linkend="g-io-channel-read"><function>g_io_channel_read()</function></link>,
<link linkend="g-io-channel-write"><function>g_io_channel_write()</function></link>, and <link linkend="g-io-channel-seek"><function>g_io_channel_seek()</function></link> on the same channel.</para>

</refsect1>
<refsect1 id="glib-IO-Channels.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="g-io-channel-unix-new" role="function">
<title>g_io_channel_unix_new&#160;()</title>
<indexterm zone="g-io-channel-unix-new"><primary sortas="io_channel_unix_new">g_io_channel_unix_new</primary></indexterm>
<programlisting language="C"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
g_io_channel_unix_new (<parameter><link linkend="int"><type>int</type></link> fd</parameter>);</programlisting>
<para>Creates a new <link linkend="GIOChannel"><type>GIOChannel</type></link> given a file descriptor. On UNIX systems
this works for plain files, pipes, and sockets.</para>
<para>The returned <link linkend="GIOChannel"><type>GIOChannel</type></link> has a reference count of 1.</para>
<para>The default encoding for <link linkend="GIOChannel"><type>GIOChannel</type></link> is UTF-8. If your application
is reading output from a command using via pipe, you may need to set
the encoding to the encoding of the current locale (see
<link linkend="g-get-charset"><function>g_get_charset()</function></link>) with the <link linkend="g-io-channel-set-encoding"><function>g_io_channel_set_encoding()</function></link> function.
By default, the fd passed will not be closed when the final reference
to the <link linkend="GIOChannel"><type>GIOChannel</type></link> data structure is dropped.</para>
<para>If you want to read raw binary data without interpretation, then
call the <link linkend="g-io-channel-set-encoding"><function>g_io_channel_set_encoding()</function></link> function with <link linkend="NULL:CAPS"><literal>NULL</literal></link> for the
encoding argument.</para>
<para>This function is available in GLib on Windows, too, but you should
avoid using it on Windows. The domain of file descriptors and
sockets overlap. There is no way for GLib to know which one you mean
in case the argument you pass to this function happens to be both a
valid file descriptor and socket. If that happens a warning is
issued, and GLib assumes that it is the file descriptor you mean.</para>
<refsect3 id="g-io-channel-unix-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>fd</para></entry>
<entry role="parameter_description"><para>a file descriptor.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-unix-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-unix-get-fd" role="function">
<title>g_io_channel_unix_get_fd&#160;()</title>
<indexterm zone="g-io-channel-unix-get-fd"><primary sortas="io_channel_unix_get_fd">g_io_channel_unix_get_fd</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_io_channel_unix_get_fd (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>Returns the file descriptor of the <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
<para>On Windows this function returns the file descriptor or socket of
the <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
<refsect3 id="g-io-channel-unix-get-fd.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link>, created with <link linkend="g-io-channel-unix-new"><function>g_io_channel_unix_new()</function></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-unix-get-fd.returns" role="returns">
<title>Returns</title>
<para> the file descriptor of the <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-win32-new-fd" role="function">
<title>g_io_channel_win32_new_fd&#160;()</title>
<indexterm zone="g-io-channel-win32-new-fd"><primary sortas="io_channel_win32_new_fd">g_io_channel_win32_new_fd</primary></indexterm>
<programlisting language="C"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
g_io_channel_win32_new_fd (<parameter><link linkend="gint"><type>gint</type></link> fd</parameter>);</programlisting>
<para>Creates a new <link linkend="GIOChannel"><type>GIOChannel</type></link> given a file descriptor on Windows. This
works for file descriptors from the C runtime.</para>
<para>This function works for file descriptors as returned by the <link linkend="open"><function>open()</function></link>,
<link linkend="creat"><function>creat()</function></link>, <link linkend="pipe"><function>pipe()</function></link> and <link linkend="fileno"><function>fileno()</function></link> calls in the Microsoft C runtime. In
order to meaningfully use this function your code should use the
same C runtime as GLib uses, which is msvcrt.dll. Note that in
current Microsoft compilers it is near impossible to convince it to
build code that would use msvcrt.dll. The last Microsoft compiler
version that supported using msvcrt.dll as the C runtime was version 6.
The GNU compiler and toolchain for Windows, also known as Mingw,
fully supports msvcrt.dll.</para>
<para>If you have created a <link linkend="GIOChannel"><type>GIOChannel</type></link> for a file descriptor and started
watching (polling) it, you shouldn't call <link linkend="read"><function>read()</function></link> on the file
descriptor. This is because adding polling for a file descriptor is
implemented in GLib on Windows by starting a thread that sits
blocked in a <link linkend="read"><function>read()</function></link> from the file descriptor most of the time. All
reads from the file descriptor should be done by this internal GLib
thread. Your code should call only <link linkend="g-io-channel-read"><function>g_io_channel_read()</function></link>.</para>
<para>This function is available only in GLib on Windows.</para>
<refsect3 id="g-io-channel-win32-new-fd.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>fd</para></entry>
<entry role="parameter_description"><para>a C library file descriptor.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-win32-new-fd.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-win32-new-socket" role="function">
<title>g_io_channel_win32_new_socket&#160;()</title>
<indexterm zone="g-io-channel-win32-new-socket"><primary sortas="io_channel_win32_new_socket">g_io_channel_win32_new_socket</primary></indexterm>
<programlisting language="C"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
g_io_channel_win32_new_socket (<parameter><link linkend="gint"><type>gint</type></link> socket</parameter>);</programlisting>
<para>Creates a new <link linkend="GIOChannel"><type>GIOChannel</type></link> given a socket on Windows.</para>
<para>This function works for sockets created by Winsock. It's available
only in GLib on Windows.</para>
<para>Polling a <link linkend="GSource"><type>GSource</type></link> created to watch a channel for a socket puts the
socket in non-blocking mode. This is a side-effect of the
implementation and unavoidable.</para>
<refsect3 id="g-io-channel-win32-new-socket.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>socket</para></entry>
<entry role="parameter_description"><para>a Winsock socket</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-win32-new-socket.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GIOChannel"><type>GIOChannel</type></link></para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-win32-new-messages" role="function">
<title>g_io_channel_win32_new_messages&#160;()</title>
<indexterm zone="g-io-channel-win32-new-messages"><primary sortas="io_channel_win32_new_messages">g_io_channel_win32_new_messages</primary></indexterm>
<programlisting language="C"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
g_io_channel_win32_new_messages (<parameter><link linkend="gsize"><type>gsize</type></link> hwnd</parameter>);</programlisting>
<para>Creates a new <link linkend="GIOChannel"><type>GIOChannel</type></link> given a window handle on Windows.</para>
<para>This function creates a <link linkend="GIOChannel"><type>GIOChannel</type></link> that can be used to poll for
Windows messages for the window in question.</para>
<refsect3 id="g-io-channel-win32-new-messages.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>hwnd</para></entry>
<entry role="parameter_description"><para>a window handle.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-win32-new-messages.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-init" role="function">
<title>g_io_channel_init&#160;()</title>
<indexterm zone="g-io-channel-init"><primary sortas="io_channel_init">g_io_channel_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_io_channel_init (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>Initializes a <link linkend="GIOChannel"><type>GIOChannel</type></link> struct. </para>
<para>This is called by each of the above functions when creating a 
<link linkend="GIOChannel"><type>GIOChannel</type></link>, and so is not often needed by the application 
programmer (unless you are creating a new type of <link linkend="GIOChannel"><type>GIOChannel</type></link>).</para>
<refsect3 id="g-io-channel-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-io-channel-new-file" role="function">
<title>g_io_channel_new_file&#160;()</title>
<indexterm zone="g-io-channel-new-file"><primary sortas="io_channel_new_file">g_io_channel_new_file</primary></indexterm>
<programlisting language="C"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
g_io_channel_new_file (<parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *mode</parameter>,
                       <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Open a file <parameter>filename</parameter>
 as a <link linkend="GIOChannel"><type>GIOChannel</type></link> using mode <parameter>mode</parameter>
. This
channel will be closed when the last reference to it is dropped,
so there is no need to call <link linkend="g-io-channel-close"><function>g_io_channel_close()</function></link> (though doing
so will not cause problems, as long as no attempt is made to
access the channel after it is closed).</para>
<refsect3 id="g-io-channel-new-file.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>A string containing the name of a file. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
<row><entry role="parameter_name"><para>mode</para></entry>
<entry role="parameter_description"><para>One of "r", "w", "a", "r+", "w+", "a+". These have
the same meaning as in <link linkend="fopen"><function>fopen()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>A location to return an error of type <link linkend="G-FILE-ERROR:CAPS"><literal>G_FILE_ERROR</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-new-file.returns" role="returns">
<title>Returns</title>
<para> A <link linkend="GIOChannel"><type>GIOChannel</type></link> on success, <link linkend="NULL:CAPS"><literal>NULL</literal></link> on failure.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-read-chars" role="function">
<title>g_io_channel_read_chars&#160;()</title>
<indexterm zone="g-io-channel-read-chars"><primary sortas="io_channel_read_chars">g_io_channel_read_chars</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_read_chars (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                         <parameter><link linkend="gchar"><type>gchar</type></link> *buf</parameter>,
                         <parameter><link linkend="gsize"><type>gsize</type></link> count</parameter>,
                         <parameter><link linkend="gsize"><type>gsize</type></link> *bytes_read</parameter>,
                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Replacement for <link linkend="g-io-channel-read"><function>g_io_channel_read()</function></link> with the new API.</para>
<refsect3 id="g-io-channel-read-chars.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>buf</para></entry>
<entry role="parameter_description"><para>a buffer to read data into. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out caller-allocates</acronym>][<acronym>array</acronym> length=count][<acronym>element-type</acronym> guint8]</emphasis></entry></row>
<row><entry role="parameter_name"><para>count</para></entry>
<entry role="parameter_description"><para>the size of the buffer. Note that the buffer may not be
complelely filled even if there is data in the buffer if the
remaining data is not a complete character. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>in</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>bytes_read</para></entry>
<entry role="parameter_description"><para>The number of bytes read. This may be
zero even on success if count &lt; 6 and the channel's encoding
is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>. This indicates that the next UTF-8 character is
too wide for the buffer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>a location to return an error of type <link linkend="GConvertError"><type>GConvertError</type></link>
or <link linkend="GIOChannelError"><type>GIOChannelError</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-read-chars.returns" role="returns">
<title>Returns</title>
<para> the status of the operation.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-read-unichar" role="function">
<title>g_io_channel_read_unichar&#160;()</title>
<indexterm zone="g-io-channel-read-unichar"><primary sortas="io_channel_read_unichar">g_io_channel_read_unichar</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_read_unichar (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                           <parameter><link linkend="gunichar"><type>gunichar</type></link> *thechar</parameter>,
                           <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Reads a Unicode character from <parameter>channel</parameter>
.
This function cannot be called on a channel with <link linkend="NULL:CAPS"><literal>NULL</literal></link> encoding.</para>
<refsect3 id="g-io-channel-read-unichar.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>thechar</para></entry>
<entry role="parameter_description"><para>a location to return a character. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>a location to return an error of type <link linkend="GConvertError"><type>GConvertError</type></link>
or <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-read-unichar.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="GIOStatus"><type>GIOStatus</type></link></para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-read-line" role="function">
<title>g_io_channel_read_line&#160;()</title>
<indexterm zone="g-io-channel-read-line"><primary sortas="io_channel_read_line">g_io_channel_read_line</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_read_line (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                        <parameter><link linkend="gchar"><type>gchar</type></link> **str_return</parameter>,
                        <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>,
                        <parameter><link linkend="gsize"><type>gsize</type></link> *terminator_pos</parameter>,
                        <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Reads a line, including the terminating character(s),
from a <link linkend="GIOChannel"><type>GIOChannel</type></link> into a newly-allocated string.
<parameter>str_return</parameter>
 will contain allocated memory if the return
is <link linkend="G-IO-STATUS-NORMAL:CAPS"><literal>G_IO_STATUS_NORMAL</literal></link>.</para>
<refsect3 id="g-io-channel-read-line.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>str_return</para></entry>
<entry role="parameter_description"><para>The line read from the <link linkend="GIOChannel"><type>GIOChannel</type></link>, including the
line terminator. This data should be freed with <link linkend="g-free"><function>g_free()</function></link>
when no longer needed. This is a nul-terminated string.
If a <parameter>length</parameter>
of zero is returned, this will be <link linkend="NULL:CAPS"><literal>NULL</literal></link> instead. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>location to store length of the read data, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>terminator_pos</para></entry>
<entry role="parameter_description"><para>location to store position of line terminator, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>A location to return an error of type <link linkend="GConvertError"><type>GConvertError</type></link>
or <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-read-line.returns" role="returns">
<title>Returns</title>
<para> the status of the operation.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-read-line-string" role="function">
<title>g_io_channel_read_line_string&#160;()</title>
<indexterm zone="g-io-channel-read-line-string"><primary sortas="io_channel_read_line_string">g_io_channel_read_line_string</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_read_line_string (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                               <parameter><link linkend="GString"><type>GString</type></link> *buffer</parameter>,
                               <parameter><link linkend="gsize"><type>gsize</type></link> *terminator_pos</parameter>,
                               <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Reads a line from a <link linkend="GIOChannel"><type>GIOChannel</type></link>, using a <link linkend="GString"><type>GString</type></link> as a buffer.</para>
<refsect3 id="g-io-channel-read-line-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>buffer</para></entry>
<entry role="parameter_description"><para>a <link linkend="GString"><type>GString</type></link> into which the line will be written.
If <parameter>buffer</parameter>
already contains data, the old data will
be overwritten.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>terminator_pos</para></entry>
<entry role="parameter_description"><para>location to store position of line terminator, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>a location to store an error of type <link linkend="GConvertError"><type>GConvertError</type></link>
or <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-read-line-string.returns" role="returns">
<title>Returns</title>
<para> the status of the operation.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-read-to-end" role="function">
<title>g_io_channel_read_to_end&#160;()</title>
<indexterm zone="g-io-channel-read-to-end"><primary sortas="io_channel_read_to_end">g_io_channel_read_to_end</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_read_to_end (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                          <parameter><link linkend="gchar"><type>gchar</type></link> **str_return</parameter>,
                          <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>,
                          <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Reads all the remaining data from the file.</para>
<refsect3 id="g-io-channel-read-to-end.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>str_return</para></entry>
<entry role="parameter_description"><para>Location to
store a pointer to a string holding the remaining data in the
<link linkend="GIOChannel"><type>GIOChannel</type></link>. This data should be freed with <link linkend="g-free"><function>g_free()</function></link> when no
longer needed. This data is terminated by an extra nul
character, but there may be other nuls in the intervening data. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>array</acronym> length=length][<acronym>element-type</acronym> guint8]</emphasis></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>location to store length of the data. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>location to return an error of type <link linkend="GConvertError"><type>GConvertError</type></link>
or <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-read-to-end.returns" role="returns">
<title>Returns</title>
<para> <link linkend="G-IO-STATUS-NORMAL:CAPS"><literal>G_IO_STATUS_NORMAL</literal></link> on success.
This function never returns <link linkend="G-IO-STATUS-EOF:CAPS"><literal>G_IO_STATUS_EOF</literal></link>.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-write-chars" role="function">
<title>g_io_channel_write_chars&#160;()</title>
<indexterm zone="g-io-channel-write-chars"><primary sortas="io_channel_write_chars">g_io_channel_write_chars</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_write_chars (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                          <parameter>const <link linkend="gchar"><type>gchar</type></link> *buf</parameter>,
                          <parameter><link linkend="gssize"><type>gssize</type></link> count</parameter>,
                          <parameter><link linkend="gsize"><type>gsize</type></link> *bytes_written</parameter>,
                          <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Replacement for <link linkend="g-io-channel-write"><function>g_io_channel_write()</function></link> with the new API.</para>
<para>On seekable channels with encodings other than <link linkend="NULL:CAPS"><literal>NULL</literal></link> or UTF-8, generic
mixing of reading and writing is not allowed. A call to <link linkend="g-io-channel-write-chars"><function>g_io_channel_write_chars()</function></link>
may only be made on a channel from which data has been read in the
cases described in the documentation for <link linkend="g-io-channel-set-encoding"><function>g_io_channel_set_encoding()</function></link>.</para>
<refsect3 id="g-io-channel-write-chars.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>buf</para></entry>
<entry role="parameter_description"><para>a buffer to write data from. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym>][<acronym>element-type</acronym> guint8]</emphasis></entry></row>
<row><entry role="parameter_name"><para>count</para></entry>
<entry role="parameter_description"><para>the size of the buffer. If -1, the buffer
is taken to be a nul-terminated string.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>bytes_written</para></entry>
<entry role="parameter_description"><para>The number of bytes written. This can be nonzero
even if the return value is not <link linkend="G-IO-STATUS-NORMAL:CAPS"><literal>G_IO_STATUS_NORMAL</literal></link>.
If the return value is <link linkend="G-IO-STATUS-NORMAL:CAPS"><literal>G_IO_STATUS_NORMAL</literal></link> and the
channel is blocking, this will always be equal
to <parameter>count</parameter>
if <parameter>count</parameter>
&gt;= 0. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>a location to return an error of type <link linkend="GConvertError"><type>GConvertError</type></link>
or <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-write-chars.returns" role="returns">
<title>Returns</title>
<para> the status of the operation.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-write-unichar" role="function">
<title>g_io_channel_write_unichar&#160;()</title>
<indexterm zone="g-io-channel-write-unichar"><primary sortas="io_channel_write_unichar">g_io_channel_write_unichar</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_write_unichar (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                            <parameter><link linkend="gunichar"><type>gunichar</type></link> thechar</parameter>,
                            <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Writes a Unicode character to <parameter>channel</parameter>
.
This function cannot be called on a channel with <link linkend="NULL:CAPS"><literal>NULL</literal></link> encoding.</para>
<refsect3 id="g-io-channel-write-unichar.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>thechar</para></entry>
<entry role="parameter_description"><para>a character</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>location to return an error of type <link linkend="GConvertError"><type>GConvertError</type></link>
or <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-write-unichar.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="GIOStatus"><type>GIOStatus</type></link></para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-flush" role="function">
<title>g_io_channel_flush&#160;()</title>
<indexterm zone="g-io-channel-flush"><primary sortas="io_channel_flush">g_io_channel_flush</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_flush (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                    <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Flushes the write buffer for the GIOChannel.</para>
<refsect3 id="g-io-channel-flush.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>location to store an error of type <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-flush.returns" role="returns">
<title>Returns</title>
<para> the status of the operation: One of
<link linkend="G-IO-STATUS-NORMAL:CAPS"><type>G_IO_STATUS_NORMAL</type></link>, <link linkend="G-IO-STATUS-AGAIN:CAPS"><type>G_IO_STATUS_AGAIN</type></link>, or
<link linkend="G-IO-STATUS-ERROR:CAPS"><type>G_IO_STATUS_ERROR</type></link>.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-seek-position" role="function">
<title>g_io_channel_seek_position&#160;()</title>
<indexterm zone="g-io-channel-seek-position"><primary sortas="io_channel_seek_position">g_io_channel_seek_position</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_seek_position (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                            <parameter><link linkend="gint64"><type>gint64</type></link> offset</parameter>,
                            <parameter><link linkend="GSeekType"><type>GSeekType</type></link> type</parameter>,
                            <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Replacement for <link linkend="g-io-channel-seek"><function>g_io_channel_seek()</function></link> with the new API.</para>
<refsect3 id="g-io-channel-seek-position.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>offset</para></entry>
<entry role="parameter_description"><para>The offset in bytes from the position specified by <parameter>type</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GSeekType"><type>GSeekType</type></link>. The type <link linkend="G-SEEK-CUR:CAPS"><literal>G_SEEK_CUR</literal></link> is only allowed in those
cases where a call to <link linkend="g-io-channel-set-encoding"><function>g_io_channel_set_encoding()</function></link>
is allowed. See the documentation for
<link linkend="g-io-channel-set-encoding"><function>g_io_channel_set_encoding()</function></link> for details.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>A location to return an error of type <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-seek-position.returns" role="returns">
<title>Returns</title>
<para> the status of the operation.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-shutdown" role="function">
<title>g_io_channel_shutdown&#160;()</title>
<indexterm zone="g-io-channel-shutdown"><primary sortas="io_channel_shutdown">g_io_channel_shutdown</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_shutdown (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                       <parameter><link linkend="gboolean"><type>gboolean</type></link> flush</parameter>,
                       <parameter><link linkend="GError"><type>GError</type></link> **err</parameter>);</programlisting>
<para>Close an IO channel. Any pending data to be written will be
flushed if <parameter>flush</parameter>
 is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>. The channel will not be freed until the
last reference is dropped using <link linkend="g-io-channel-unref"><function>g_io_channel_unref()</function></link>.</para>
<refsect3 id="g-io-channel-shutdown.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>flush</para></entry>
<entry role="parameter_description"><para>if <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, flush pending</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>err</para></entry>
<entry role="parameter_description"><para>location to store a <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-shutdown.returns" role="returns">
<title>Returns</title>
<para> the status of the operation.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-error-from-errno" role="function">
<title>g_io_channel_error_from_errno&#160;()</title>
<indexterm zone="g-io-channel-error-from-errno"><primary sortas="io_channel_error_from_errno">g_io_channel_error_from_errno</primary></indexterm>
<programlisting language="C"><link linkend="GIOChannelError"><returnvalue>GIOChannelError</returnvalue></link>
g_io_channel_error_from_errno (<parameter><link linkend="gint"><type>gint</type></link> en</parameter>);</programlisting>
<para>Converts an <literal>errno</literal> error number to a <link linkend="GIOChannelError"><type>GIOChannelError</type></link>.</para>
<refsect3 id="g-io-channel-error-from-errno.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>en</para></entry>
<entry role="parameter_description"><para>an <literal>errno</literal> error number, e.g. <literal>EINVAL</literal></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-error-from-errno.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="GIOChannelError"><type>GIOChannelError</type></link> error number, e.g.
<link linkend="G-IO-CHANNEL-ERROR-INVAL:CAPS"><literal>G_IO_CHANNEL_ERROR_INVAL</literal></link>.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-ref" role="function">
<title>g_io_channel_ref&#160;()</title>
<indexterm zone="g-io-channel-ref"><primary sortas="io_channel_ref">g_io_channel_ref</primary></indexterm>
<programlisting language="C"><link linkend="GIOChannel"><returnvalue>GIOChannel</returnvalue></link>&#160;*
g_io_channel_ref (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>Increments the reference count of a <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
<refsect3 id="g-io-channel-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-ref.returns" role="returns">
<title>Returns</title>
<para> the <parameter>channel</parameter>
that was passed in (since 2.6)</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-unref" role="function">
<title>g_io_channel_unref&#160;()</title>
<indexterm zone="g-io-channel-unref"><primary sortas="io_channel_unref">g_io_channel_unref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_io_channel_unref (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>Decrements the reference count of a <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
<refsect3 id="g-io-channel-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-io-create-watch" role="function">
<title>g_io_create_watch&#160;()</title>
<indexterm zone="g-io-create-watch"><primary sortas="io_create_watch">g_io_create_watch</primary></indexterm>
<programlisting language="C"><link linkend="GSource"><returnvalue>GSource</returnvalue></link>&#160;*
g_io_create_watch (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                   <parameter><link linkend="GIOCondition"><type>GIOCondition</type></link> condition</parameter>);</programlisting>
<para>Creates a <link linkend="GSource"><type>GSource</type></link> that's dispatched when <parameter>condition</parameter>
 is met for the 
given <parameter>channel</parameter>
. For example, if condition is <link linkend="G-IO-IN:CAPS"><type>G_IO_IN</type></link>, the source will 
be dispatched when there's data available for reading.</para>
<para>g_io_add_watch() is a simpler interface to this same functionality, for 
the case where you want to add the source to the default main loop context 
at the default priority.</para>
<para>On Windows, polling a <link linkend="GSource"><type>GSource</type></link> created to watch a channel for a socket
puts the socket in non-blocking mode. This is a side-effect of the
implementation and unavoidable.</para>
<refsect3 id="g-io-create-watch.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link> to watch</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>condition</para></entry>
<entry role="parameter_description"><para>conditions to watch for</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-create-watch.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GSource"><type>GSource</type></link></para>
</refsect3></refsect2>
<refsect2 id="g-io-add-watch" role="function">
<title>g_io_add_watch&#160;()</title>
<indexterm zone="g-io-add-watch"><primary sortas="io_add_watch">g_io_add_watch</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
g_io_add_watch (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                <parameter><link linkend="GIOCondition"><type>GIOCondition</type></link> condition</parameter>,
                <parameter><link linkend="GIOFunc"><type>GIOFunc</type></link> func</parameter>,
                <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>Adds the <link linkend="GIOChannel"><type>GIOChannel</type></link> into the default main loop context
with the default priority.</para>
<refsect3 id="g-io-add-watch.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>condition</para></entry>
<entry role="parameter_description"><para>the condition to watch for</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>func</para></entry>
<entry role="parameter_description"><para>the function to call when the condition is satisfied</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data to pass to <parameter>func</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-add-watch.returns" role="returns">
<title>Returns</title>
<para> the event source id</para>
</refsect3></refsect2>
<refsect2 id="g-io-add-watch-full" role="function">
<title>g_io_add_watch_full&#160;()</title>
<indexterm zone="g-io-add-watch-full"><primary sortas="io_add_watch_full">g_io_add_watch_full</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
g_io_add_watch_full (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                     <parameter><link linkend="gint"><type>gint</type></link> priority</parameter>,
                     <parameter><link linkend="GIOCondition"><type>GIOCondition</type></link> condition</parameter>,
                     <parameter><link linkend="GIOFunc"><type>GIOFunc</type></link> func</parameter>,
                     <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>,
                     <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> notify</parameter>);</programlisting>
<para>Adds the <link linkend="GIOChannel"><type>GIOChannel</type></link> into the default main loop context
with the given priority.</para>
<para>This internally creates a main loop source using <link linkend="g-io-create-watch"><function>g_io_create_watch()</function></link>
and attaches it to the main loop context with <link linkend="g-source-attach"><function>g_source_attach()</function></link>.
You can do these steps manually if you need greater control.</para>

<para><emphasis role="annotation">[<acronym>rename-to</acronym> g_io_add_watch]</emphasis></para><refsect3 id="g-io-add-watch-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>priority</para></entry>
<entry role="parameter_description"><para>the priority of the <link linkend="GIOChannel"><type>GIOChannel</type></link> source</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>condition</para></entry>
<entry role="parameter_description"><para>the condition to watch for</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>func</para></entry>
<entry role="parameter_description"><para>the function to call when the condition is satisfied</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data to pass to <parameter>func</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>notify</para></entry>
<entry role="parameter_description"><para>the function to call when the source is removed</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-add-watch-full.returns" role="returns">
<title>Returns</title>
<para> the event source id</para>
</refsect3></refsect2>
<refsect2 id="GIOFunc" role="function">
<title>GIOFunc&#160;()</title>
<indexterm zone="GIOFunc"><primary sortas="IOFunc">GIOFunc</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GIOFunc<phrase role="c_punctuation">)</phrase> (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *source</parameter>,
            <parameter><link linkend="GIOCondition"><type>GIOCondition</type></link> condition</parameter>,
            <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Specifies the type of function passed to <link linkend="g-io-add-watch"><function>g_io_add_watch()</function></link> or
<link linkend="g-io-add-watch-full"><function>g_io_add_watch_full()</function></link>, which is called when the requested condition
on a <link linkend="GIOChannel"><type>GIOChannel</type></link> is satisfied.</para>
<refsect3 id="GIOFunc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>source</para></entry>
<entry role="parameter_description"><para>the <link linkend="GIOChannel"><type>GIOChannel</type></link> event source</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>condition</para></entry>
<entry role="parameter_description"><para>the condition which has been satisfied</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>user data set in <link linkend="g-io-add-watch"><function>g_io_add_watch()</function></link> or <link linkend="g-io-add-watch-full"><function>g_io_add_watch_full()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="GIOFunc.returns" role="returns">
<title>Returns</title>
<para> the function should return <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if the event source
should be removed</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-get-buffer-size" role="function">
<title>g_io_channel_get_buffer_size&#160;()</title>
<indexterm zone="g-io-channel-get-buffer-size"><primary sortas="io_channel_get_buffer_size">g_io_channel_get_buffer_size</primary></indexterm>
<programlisting language="C"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
g_io_channel_get_buffer_size (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>Gets the buffer size.</para>
<refsect3 id="g-io-channel-get-buffer-size.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-get-buffer-size.returns" role="returns">
<title>Returns</title>
<para> the size of the buffer.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-set-buffer-size" role="function">
<title>g_io_channel_set_buffer_size&#160;()</title>
<indexterm zone="g-io-channel-set-buffer-size"><primary sortas="io_channel_set_buffer_size">g_io_channel_set_buffer_size</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_io_channel_set_buffer_size (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                              <parameter><link linkend="gsize"><type>gsize</type></link> size</parameter>);</programlisting>
<para>Sets the buffer size.</para>
<refsect3 id="g-io-channel-set-buffer-size.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>size</para></entry>
<entry role="parameter_description"><para>the size of the buffer, or 0 to let GLib pick a good size</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-io-channel-get-buffer-condition" role="function">
<title>g_io_channel_get_buffer_condition&#160;()</title>
<indexterm zone="g-io-channel-get-buffer-condition"><primary sortas="io_channel_get_buffer_condition">g_io_channel_get_buffer_condition</primary></indexterm>
<programlisting language="C"><link linkend="GIOCondition"><returnvalue>GIOCondition</returnvalue></link>
g_io_channel_get_buffer_condition (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>This function returns a <link linkend="GIOCondition"><type>GIOCondition</type></link> depending on whether there
is data to be read/space to write data in the internal buffers in 
the <link linkend="GIOChannel"><type>GIOChannel</type></link>. Only the flags <link linkend="G-IO-IN:CAPS"><literal>G_IO_IN</literal></link> and <link linkend="G-IO-OUT:CAPS"><literal>G_IO_OUT</literal></link> may be set.</para>
<refsect3 id="g-io-channel-get-buffer-condition.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>A <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-get-buffer-condition.returns" role="returns">
<title>Returns</title>
<para> A <link linkend="GIOCondition"><type>GIOCondition</type></link></para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-get-flags" role="function">
<title>g_io_channel_get_flags&#160;()</title>
<indexterm zone="g-io-channel-get-flags"><primary sortas="io_channel_get_flags">g_io_channel_get_flags</primary></indexterm>
<programlisting language="C"><link linkend="GIOFlags"><returnvalue>GIOFlags</returnvalue></link>
g_io_channel_get_flags (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>Gets the current flags for a <link linkend="GIOChannel"><type>GIOChannel</type></link>, including read-only
flags such as <link linkend="G-IO-FLAG-IS-READABLE:CAPS"><literal>G_IO_FLAG_IS_READABLE</literal></link>.</para>
<para>The values of the flags <link linkend="G-IO-FLAG-IS-READABLE:CAPS"><literal>G_IO_FLAG_IS_READABLE</literal></link> and <link linkend="G-IO-FLAG-IS-WRITABLE:CAPS"><literal>G_IO_FLAG_IS_WRITABLE</literal></link>
are cached for internal use by the channel when it is created.
If they should change at some later point (e.g. partial shutdown
of a socket with the UNIX <link linkend="shutdown"><function>shutdown()</function></link> function), the user
should immediately call <link linkend="g-io-channel-get-flags"><function>g_io_channel_get_flags()</function></link> to update
the internal values of these flags.</para>
<refsect3 id="g-io-channel-get-flags.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-get-flags.returns" role="returns">
<title>Returns</title>
<para> the flags which are set on the channel</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-set-flags" role="function">
<title>g_io_channel_set_flags&#160;()</title>
<indexterm zone="g-io-channel-set-flags"><primary sortas="io_channel_set_flags">g_io_channel_set_flags</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_set_flags (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                        <parameter><link linkend="GIOFlags"><type>GIOFlags</type></link> flags</parameter>,
                        <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Sets the (writeable) flags in <parameter>channel</parameter>
 to (<parameter>flags</parameter>
 &amp; <link linkend="G-IO-FLAG-SET-MASK:CAPS"><literal>G_IO_FLAG_SET_MASK</literal></link>).</para>
<refsect3 id="g-io-channel-set-flags.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>flags</para></entry>
<entry role="parameter_description"><para>the flags to set on the IO channel</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>A location to return an error of type <link linkend="GIOChannelError"><type>GIOChannelError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-set-flags.returns" role="returns">
<title>Returns</title>
<para> the status of the operation. </para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-get-line-term" role="function">
<title>g_io_channel_get_line_term&#160;()</title>
<indexterm zone="g-io-channel-get-line-term"><primary sortas="io_channel_get_line_term">g_io_channel_get_line_term</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_io_channel_get_line_term (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                            <parameter><link linkend="gint"><type>gint</type></link> *length</parameter>);</programlisting>
<para>This returns the string that <link linkend="GIOChannel"><type>GIOChannel</type></link> uses to determine
where in the file a line break occurs. A value of <link linkend="NULL:CAPS"><literal>NULL</literal></link>
indicates autodetection.</para>
<refsect3 id="g-io-channel-get-line-term.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>a location to return the length of the line terminator</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-get-line-term.returns" role="returns">
<title>Returns</title>
<para> The line termination string. This value
is owned by GLib and must not be freed.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-set-line-term" role="function">
<title>g_io_channel_set_line_term&#160;()</title>
<indexterm zone="g-io-channel-set-line-term"><primary sortas="io_channel_set_line_term">g_io_channel_set_line_term</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_io_channel_set_line_term (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                            <parameter>const <link linkend="gchar"><type>gchar</type></link> *line_term</parameter>,
                            <parameter><link linkend="gint"><type>gint</type></link> length</parameter>);</programlisting>
<para>This sets the string that <link linkend="GIOChannel"><type>GIOChannel</type></link> uses to determine
where in the file a line break occurs.</para>
<refsect3 id="g-io-channel-set-line-term.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>line_term</para></entry>
<entry role="parameter_description"><para>The line termination string. Use <link linkend="NULL:CAPS"><literal>NULL</literal></link> for
autodetect.  Autodetection breaks on "\n", "\r\n", "\r", "\0",
and the Unicode paragraph separator. Autodetection should not be
used for anything other than file-based channels. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>The length of the termination string. If -1 is passed, the
string is assumed to be nul-terminated. This option allows
termination strings with embedded nuls.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-io-channel-get-buffered" role="function">
<title>g_io_channel_get_buffered&#160;()</title>
<indexterm zone="g-io-channel-get-buffered"><primary sortas="io_channel_get_buffered">g_io_channel_get_buffered</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_io_channel_get_buffered (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>Returns whether <parameter>channel</parameter>
 is buffered.</para>
<refsect3 id="g-io-channel-get-buffered.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-get-buffered.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the <parameter>channel</parameter>
is buffered. </para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-set-buffered" role="function">
<title>g_io_channel_set_buffered&#160;()</title>
<indexterm zone="g-io-channel-set-buffered"><primary sortas="io_channel_set_buffered">g_io_channel_set_buffered</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_io_channel_set_buffered (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                           <parameter><link linkend="gboolean"><type>gboolean</type></link> buffered</parameter>);</programlisting>
<para>The buffering state can only be set if the channel's encoding
is <link linkend="NULL:CAPS"><literal>NULL</literal></link>. For any other encoding, the channel must be buffered.</para>
<para>A buffered channel can only be set unbuffered if the channel's
internal buffers have been flushed. Newly created channels or
channels which have returned <link linkend="G-IO-STATUS-EOF:CAPS"><literal>G_IO_STATUS_EOF</literal></link>
not require such a flush. For write-only channels, a call to
<link linkend="g-io-channel-flush"><function>g_io_channel_flush()</function></link> is sufficient. For all other channels,
the buffers may be flushed by a call to <link linkend="g-io-channel-seek-position"><function>g_io_channel_seek_position()</function></link>.
This includes the possibility of seeking with seek type <link linkend="G-SEEK-CUR:CAPS"><literal>G_SEEK_CUR</literal></link>
and an offset of zero. Note that this means that socket-based
channels cannot be set unbuffered once they have had data
read from them.</para>
<para>On unbuffered channels, it is safe to mix read and write
calls from the new and old APIs, if this is necessary for
maintaining old code.</para>
<para>The default state of the channel is buffered.</para>
<refsect3 id="g-io-channel-set-buffered.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>buffered</para></entry>
<entry role="parameter_description"><para>whether to set the channel buffered or unbuffered</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-io-channel-get-encoding" role="function">
<title>g_io_channel_get_encoding&#160;()</title>
<indexterm zone="g-io-channel-get-encoding"><primary sortas="io_channel_get_encoding">g_io_channel_get_encoding</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_io_channel_get_encoding (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>Gets the encoding for the input/output of the channel. 
The internal encoding is always UTF-8. The encoding <link linkend="NULL:CAPS"><literal>NULL</literal></link> 
makes the channel safe for binary data.</para>
<refsect3 id="g-io-channel-get-encoding.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-get-encoding.returns" role="returns">
<title>Returns</title>
<para> A string containing the encoding, this string is
owned by GLib and must not be freed.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-set-encoding" role="function">
<title>g_io_channel_set_encoding&#160;()</title>
<indexterm zone="g-io-channel-set-encoding"><primary sortas="io_channel_set_encoding">g_io_channel_set_encoding</primary></indexterm>
<programlisting language="C"><link linkend="GIOStatus"><returnvalue>GIOStatus</returnvalue></link>
g_io_channel_set_encoding (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                           <parameter>const <link linkend="gchar"><type>gchar</type></link> *encoding</parameter>,
                           <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Sets the encoding for the input/output of the channel. 
The internal encoding is always UTF-8. The default encoding 
for the external file is UTF-8.</para>
<para>The encoding <link linkend="NULL:CAPS"><literal>NULL</literal></link> is safe to use with binary data.</para>
<para>The encoding can only be set if one of the following conditions
is true:</para>
<itemizedlist>
<listitem>
<para>The channel was just created, and has not been written to or read from yet.</para>
</listitem>
<listitem>
<para>The channel is write-only.</para>
</listitem>
<listitem>
<para>The channel is a file, and the file pointer was just repositioned
by a call to <link linkend="g-io-channel-seek-position"><function>g_io_channel_seek_position()</function></link>. (This flushes all the
internal buffers.)</para>
</listitem>
<listitem>
<para>The current encoding is <link linkend="NULL:CAPS"><literal>NULL</literal></link> or UTF-8.</para>
</listitem>
<listitem>
<para>One of the (new API) read functions has just returned <link linkend="G-IO-STATUS-EOF:CAPS"><literal>G_IO_STATUS_EOF</literal></link>
(or, in the case of <link linkend="g-io-channel-read-to-end"><function>g_io_channel_read_to_end()</function></link>, <link linkend="G-IO-STATUS-NORMAL:CAPS"><literal>G_IO_STATUS_NORMAL</literal></link>).</para>
</listitem>
<listitem>
<para>One of the functions <link linkend="g-io-channel-read-chars"><function>g_io_channel_read_chars()</function></link> or 
<link linkend="g-io-channel-read-unichar"><function>g_io_channel_read_unichar()</function></link> has returned <link linkend="G-IO-STATUS-AGAIN:CAPS"><literal>G_IO_STATUS_AGAIN</literal></link> or 
<link linkend="G-IO-STATUS-ERROR:CAPS"><literal>G_IO_STATUS_ERROR</literal></link>. This may be useful in the case of 
<link linkend="G-CONVERT-ERROR-ILLEGAL-SEQUENCE:CAPS"><literal>G_CONVERT_ERROR_ILLEGAL_SEQUENCE</literal></link>.
Returning one of these statuses from <link linkend="g-io-channel-read-line"><function>g_io_channel_read_line()</function></link>,
<link linkend="g-io-channel-read-line-string"><function>g_io_channel_read_line_string()</function></link>, or <link linkend="g-io-channel-read-to-end"><function>g_io_channel_read_to_end()</function></link>
does not guarantee that the encoding can be changed.</para>
</listitem>
</itemizedlist>
<para>Channels which do not meet one of the above conditions cannot call
<link linkend="g-io-channel-seek-position"><function>g_io_channel_seek_position()</function></link> with an offset of <link linkend="G-SEEK-CUR:CAPS"><literal>G_SEEK_CUR</literal></link>, and, if 
they are "seekable", cannot call <link linkend="g-io-channel-write-chars"><function>g_io_channel_write_chars()</function></link> after 
calling one of the API "read" functions.</para>
<refsect3 id="g-io-channel-set-encoding.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>encoding</para></entry>
<entry role="parameter_description"><para>the encoding type. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>location to store an error of type <link linkend="GConvertError"><type>GConvertError</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-set-encoding.returns" role="returns">
<title>Returns</title>
<para> <link linkend="G-IO-STATUS-NORMAL:CAPS"><literal>G_IO_STATUS_NORMAL</literal></link> if the encoding was successfully set</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-get-close-on-unref" role="function">
<title>g_io_channel_get_close_on_unref&#160;()</title>
<indexterm zone="g-io-channel-get-close-on-unref"><primary sortas="io_channel_get_close_on_unref">g_io_channel_get_close_on_unref</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_io_channel_get_close_on_unref (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<para>Returns whether the file/socket/whatever associated with <parameter>channel</parameter>

will be closed when <parameter>channel</parameter>
 receives its final unref and is
destroyed. The default value of this is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> for channels created
by <link linkend="g-io-channel-new-file"><function>g_io_channel_new_file()</function></link>, and <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> for all other channels.</para>
<refsect3 id="g-io-channel-get-close-on-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-get-close-on-unref.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the channel will be closed, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-set-close-on-unref" role="function">
<title>g_io_channel_set_close_on_unref&#160;()</title>
<indexterm zone="g-io-channel-set-close-on-unref"><primary sortas="io_channel_set_close_on_unref">g_io_channel_set_close_on_unref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_io_channel_set_close_on_unref (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                                 <parameter><link linkend="gboolean"><type>gboolean</type></link> do_close</parameter>);</programlisting>
<para>Whether to close the channel on the final unref of the <link linkend="GIOChannel"><type>GIOChannel</type></link>
data structure. The default value of this is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> for channels
created by <link linkend="g-io-channel-new-file"><function>g_io_channel_new_file()</function></link>, and <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> for all other channels.</para>
<para>Setting this flag to <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> for a channel you have already closed
can cause problems when the final reference to the <link linkend="GIOChannel"><type>GIOChannel</type></link> is dropped.</para>
<refsect3 id="g-io-channel-set-close-on-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>do_close</para></entry>
<entry role="parameter_description"><para>Whether to close the channel on the final unref of
the GIOChannel data structure.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-io-channel-read" role="function" condition="deprecated:2.2: Use g_io_channel_read_chars() instead.">
<title>g_io_channel_read&#160;()</title>
<indexterm zone="g-io-channel-read" role="deprecated"><primary sortas="io_channel_read">g_io_channel_read</primary></indexterm>
<programlisting language="C"><link linkend="GIOError"><returnvalue>GIOError</returnvalue></link>
g_io_channel_read (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                   <parameter><link linkend="gchar"><type>gchar</type></link> *buf</parameter>,
                   <parameter><link linkend="gsize"><type>gsize</type></link> count</parameter>,
                   <parameter><link linkend="gsize"><type>gsize</type></link> *bytes_read</parameter>);</programlisting>
<warning><para><literal>g_io_channel_read</literal> has been deprecated since version 2.2 and should not be used in newly-written code.</para> <para>Use <link linkend="g-io-channel-read-chars"><function>g_io_channel_read_chars()</function></link> instead.</para>
</warning>
<para>Reads data from a <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
<refsect3 id="g-io-channel-read.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>buf</para></entry>
<entry role="parameter_description"><para>a buffer to read the data into (which should be at least
count bytes long)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>count</para></entry>
<entry role="parameter_description"><para>the number of bytes to read from the <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>bytes_read</para></entry>
<entry role="parameter_description"><para>returns the number of bytes actually read</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-read.returns" role="returns">
<title>Returns</title>
<para> <link linkend="G-IO-ERROR-NONE:CAPS"><literal>G_IO_ERROR_NONE</literal></link> if the operation was successful. </para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-write" role="function" condition="deprecated:2.2: Use g_io_channel_write_chars() instead.">
<title>g_io_channel_write&#160;()</title>
<indexterm zone="g-io-channel-write" role="deprecated"><primary sortas="io_channel_write">g_io_channel_write</primary></indexterm>
<programlisting language="C"><link linkend="GIOError"><returnvalue>GIOError</returnvalue></link>
g_io_channel_write (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                    <parameter>const <link linkend="gchar"><type>gchar</type></link> *buf</parameter>,
                    <parameter><link linkend="gsize"><type>gsize</type></link> count</parameter>,
                    <parameter><link linkend="gsize"><type>gsize</type></link> *bytes_written</parameter>);</programlisting>
<warning><para><literal>g_io_channel_write</literal> has been deprecated since version 2.2 and should not be used in newly-written code.</para> <para>Use <link linkend="g-io-channel-write-chars"><function>g_io_channel_write_chars()</function></link> instead.</para>
</warning>
<para>Writes data to a <link linkend="GIOChannel"><type>GIOChannel</type></link>.</para>
<refsect3 id="g-io-channel-write.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>buf</para></entry>
<entry role="parameter_description"><para>the buffer containing the data to write</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>count</para></entry>
<entry role="parameter_description"><para>the number of bytes to write</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>bytes_written</para></entry>
<entry role="parameter_description"><para>the number of bytes actually written</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-write.returns" role="returns">
<title>Returns</title>
<para>  <link linkend="G-IO-ERROR-NONE:CAPS"><literal>G_IO_ERROR_NONE</literal></link> if the operation was successful.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-seek" role="function" condition="deprecated:2.2: Use g_io_channel_seek_position() instead.">
<title>g_io_channel_seek&#160;()</title>
<indexterm zone="g-io-channel-seek" role="deprecated"><primary sortas="io_channel_seek">g_io_channel_seek</primary></indexterm>
<programlisting language="C"><link linkend="GIOError"><returnvalue>GIOError</returnvalue></link>
g_io_channel_seek (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>,
                   <parameter><link linkend="gint64"><type>gint64</type></link> offset</parameter>,
                   <parameter><link linkend="GSeekType"><type>GSeekType</type></link> type</parameter>);</programlisting>
<warning><para><literal>g_io_channel_seek</literal> has been deprecated since version 2.2 and should not be used in newly-written code.</para> <para>Use <link linkend="g-io-channel-seek-position"><function>g_io_channel_seek_position()</function></link> instead.</para>
</warning>
<para>Sets the current position in the <link linkend="GIOChannel"><type>GIOChannel</type></link>, similar to the standard 
library function <link linkend="fseek"><function>fseek()</function></link>.</para>
<refsect3 id="g-io-channel-seek.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>a <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>offset</para></entry>
<entry role="parameter_description"><para>an offset, in bytes, which is added to the position specified
by <parameter>type</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>the position in the file, which can be <link linkend="G-SEEK-CUR:CAPS"><literal>G_SEEK_CUR</literal></link> (the current
position), <link linkend="G-SEEK-SET:CAPS"><literal>G_SEEK_SET</literal></link> (the start of the file), or <link linkend="G-SEEK-END:CAPS"><literal>G_SEEK_END</literal></link>
(the end of the file)</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-io-channel-seek.returns" role="returns">
<title>Returns</title>
<para> <link linkend="G-IO-ERROR-NONE:CAPS"><literal>G_IO_ERROR_NONE</literal></link> if the operation was successful.</para>
</refsect3></refsect2>
<refsect2 id="g-io-channel-close" role="function" condition="deprecated:2.2: Use g_io_channel_shutdown() instead.">
<title>g_io_channel_close&#160;()</title>
<indexterm zone="g-io-channel-close" role="deprecated"><primary sortas="io_channel_close">g_io_channel_close</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_io_channel_close (<parameter><link linkend="GIOChannel"><type>GIOChannel</type></link> *channel</parameter>);</programlisting>
<warning><para><literal>g_io_channel_close</literal> has been deprecated since version 2.2 and should not be used in newly-written code.</para> <para>Use <link linkend="g-io-channel-shutdown"><function>g_io_channel_shutdown()</function></link> instead.</para>
</warning>
<para>Close an IO channel. Any pending data to be written will be
flushed, ignoring errors. The channel will not be freed until the
last reference is dropped using <link linkend="g-io-channel-unref"><function>g_io_channel_unref()</function></link>.</para>
<refsect3 id="g-io-channel-close.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>channel</para></entry>
<entry role="parameter_description"><para>A <link linkend="GIOChannel"><type>GIOChannel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="glib-IO-Channels.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GIOChannel" role="struct">
<title>struct GIOChannel</title>
<indexterm zone="GIOChannel"><primary sortas="IOChannel">GIOChannel</primary></indexterm>
<programlisting language="C">struct GIOChannel {
};
</programlisting>
<para>A data structure representing an IO Channel. The fields should be
considered private and should only be accessed with the following
functions.</para>
</refsect2>
<refsect2 id="GSeekType" role="enum">
<title>enum GSeekType</title>
<indexterm zone="GSeekType"><primary sortas="SeekType">GSeekType</primary></indexterm>
<para>An enumeration specifying the base position for a
<link linkend="g-io-channel-seek-position"><function>g_io_channel_seek_position()</function></link> operation.</para>
<refsect3 id="GSeekType.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-SEEK-CUR:CAPS">G_SEEK_CUR</para></entry>
<entry role="enum_member_description"><para>the current position in the file.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-SEEK-SET:CAPS">G_SEEK_SET</para></entry>
<entry role="enum_member_description"><para>the start of the file.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-SEEK-END:CAPS">G_SEEK_END</para></entry>
<entry role="enum_member_description"><para>the end of the file.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GIOStatus" role="enum">
<title>enum GIOStatus</title>
<indexterm zone="GIOStatus"><primary sortas="IOStatus">GIOStatus</primary></indexterm>
<para>Stati returned by most of the <link linkend="GIOFuncs"><type>GIOFuncs</type></link> functions.</para>
<refsect3 id="GIOStatus.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-STATUS-ERROR:CAPS">G_IO_STATUS_ERROR</para></entry>
<entry role="enum_member_description"><para>An error occurred.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-STATUS-NORMAL:CAPS">G_IO_STATUS_NORMAL</para></entry>
<entry role="enum_member_description"><para>Success.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-STATUS-EOF:CAPS">G_IO_STATUS_EOF</para></entry>
<entry role="enum_member_description"><para>End of file.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-STATUS-AGAIN:CAPS">G_IO_STATUS_AGAIN</para></entry>
<entry role="enum_member_description"><para>Resource temporarily unavailable.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GIOChannelError" role="enum">
<title>enum GIOChannelError</title>
<indexterm zone="GIOChannelError"><primary sortas="IOChannelError">GIOChannelError</primary></indexterm>
<para>Error codes returned by <link linkend="GIOChannel"><type>GIOChannel</type></link> operations.</para>
<refsect3 id="GIOChannelError.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-CHANNEL-ERROR-FBIG:CAPS">G_IO_CHANNEL_ERROR_FBIG</para></entry>
<entry role="enum_member_description"><para>File too large.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-CHANNEL-ERROR-INVAL:CAPS">G_IO_CHANNEL_ERROR_INVAL</para></entry>
<entry role="enum_member_description"><para>Invalid argument.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-CHANNEL-ERROR-IO:CAPS">G_IO_CHANNEL_ERROR_IO</para></entry>
<entry role="enum_member_description"><para>IO error.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-CHANNEL-ERROR-ISDIR:CAPS">G_IO_CHANNEL_ERROR_ISDIR</para></entry>
<entry role="enum_member_description"><para>File is a directory.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-CHANNEL-ERROR-NOSPC:CAPS">G_IO_CHANNEL_ERROR_NOSPC</para></entry>
<entry role="enum_member_description"><para>No space left on device.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-CHANNEL-ERROR-NXIO:CAPS">G_IO_CHANNEL_ERROR_NXIO</para></entry>
<entry role="enum_member_description"><para>No such device or address.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-CHANNEL-ERROR-OVERFLOW:CAPS">G_IO_CHANNEL_ERROR_OVERFLOW</para></entry>
<entry role="enum_member_description"><para>Value too large for defined datatype.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-CHANNEL-ERROR-PIPE:CAPS">G_IO_CHANNEL_ERROR_PIPE</para></entry>
<entry role="enum_member_description"><para>Broken pipe.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-CHANNEL-ERROR-FAILED:CAPS">G_IO_CHANNEL_ERROR_FAILED</para></entry>
<entry role="enum_member_description"><para>Some other error.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="G-IO-CHANNEL-ERROR:CAPS" role="macro">
<title>G_IO_CHANNEL_ERROR</title>
<indexterm zone="G-IO-CHANNEL-ERROR:CAPS"><primary sortas="IO_CHANNEL_ERROR">G_IO_CHANNEL_ERROR</primary></indexterm>
<programlisting language="C">#define G_IO_CHANNEL_ERROR g_io_channel_error_quark()
</programlisting>
<para>Error domain for <link linkend="GIOChannel"><type>GIOChannel</type></link> operations. Errors in this domain will
be from the <link linkend="GIOChannelError"><type>GIOChannelError</type></link> enumeration. See <link linkend="GError"><type>GError</type></link> for
information on error domains.</para>
</refsect2>
<refsect2 id="GIOCondition" role="enum">
<title>enum GIOCondition</title>
<indexterm zone="GIOCondition"><primary sortas="IOCondition">GIOCondition</primary></indexterm>
<para>A bitwise combination representing a condition to watch for on an
event source.</para>
<refsect3 id="GIOCondition.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-IN:CAPS">G_IO_IN</para></entry>
<entry role="enum_member_description"><para>There is data to read.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-OUT:CAPS">G_IO_OUT</para></entry>
<entry role="enum_member_description"><para>Data can be written (without blocking).</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-PRI:CAPS">G_IO_PRI</para></entry>
<entry role="enum_member_description"><para>There is urgent data to read.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-ERR:CAPS">G_IO_ERR</para></entry>
<entry role="enum_member_description"><para>Error condition.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-HUP:CAPS">G_IO_HUP</para></entry>
<entry role="enum_member_description"><para>Hung up (the connection has been broken, usually for
pipes and sockets).</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-NVAL:CAPS">G_IO_NVAL</para></entry>
<entry role="enum_member_description"><para>Invalid request. The file descriptor is not open.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GIOFuncs" role="struct">
<title>struct GIOFuncs</title>
<indexterm zone="GIOFuncs"><primary sortas="IOFuncs">GIOFuncs</primary></indexterm>
<programlisting language="C">struct GIOFuncs {
  GIOStatus (*io_read)           (GIOChannel   *channel,

			          gchar        *buf,

				  gsize         count,
				  gsize        *bytes_read,
				  GError      **err);
  GIOStatus (*io_write)          (GIOChannel   *channel,

				  const gchar  *buf,

				  gsize         count,
				  gsize        *bytes_written,
				  GError      **err);
  GIOStatus (*io_seek)           (GIOChannel   *channel,

				  gint64        offset,

				  GSeekType     type,
				  GError      **err);
  GIOStatus  (*io_close)         (GIOChannel   *channel,
				  GError      **err);
  GSource*   (*io_create_watch)  (GIOChannel   *channel,
				  GIOCondition  condition);
  void       (*io_free)          (GIOChannel   *channel);
  GIOStatus  (*io_set_flags)     (GIOChannel   *channel,
                                  GIOFlags      flags,
				  GError      **err);
  GIOFlags   (*io_get_flags)     (GIOChannel   *channel);
};
</programlisting>
<para>A table of functions used to handle different types of <link linkend="GIOChannel"><type>GIOChannel</type></link>
in a generic way.</para>
<refsect3 id="GIOFuncs.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><structfield id="GIOFuncs.io-read">io_read</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>reads raw bytes from the channel.  This is called from
various functions such as <link linkend="g-io-channel-read-chars"><function>g_io_channel_read_chars()</function></link> to
read raw bytes from the channel.  Encoding and buffering
issues are dealt with at a higher level.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GIOFuncs.io-write">io_write</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>writes raw bytes to the channel.  This is called from
various functions such as <link linkend="g-io-channel-write-chars"><function>g_io_channel_write_chars()</function></link> to
write raw bytes to the channel.  Encoding and buffering
issues are dealt with at a higher level.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GIOFuncs.io-seek">io_seek</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>(optional) seeks the channel.  This is called from
<link linkend="g-io-channel-seek"><function>g_io_channel_seek()</function></link> on channels that support it.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GIOFuncs.io-close">io_close</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>closes the channel.  This is called from
<link linkend="g-io-channel-close"><function>g_io_channel_close()</function></link> after flushing the buffers.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GIOFuncs.io-create-watch">io_create_watch</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>creates a watch on the channel.  This call
corresponds directly to <link linkend="g-io-create-watch"><function>g_io_create_watch()</function></link>.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GIOFuncs.io-free">io_free</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>called from <link linkend="g-io-channel-unref"><function>g_io_channel_unref()</function></link> when the channel needs to
be freed.  This function must free the memory associated
with the channel, including freeing the <link linkend="GIOChannel"><type>GIOChannel</type></link>
structure itself.  The channel buffers have been flushed
and possibly <parameter>io_close</parameter>
has been called by the time this
function is called.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GIOFuncs.io-set-flags">io_set_flags</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>sets the <link linkend="GIOFlags"><type>GIOFlags</type></link> on the channel.  This is called
from <link linkend="g-io-channel-set-flags"><function>g_io_channel_set_flags()</function></link> with all flags except
for <link linkend="G-IO-FLAG-APPEND:CAPS"><literal>G_IO_FLAG_APPEND</literal></link> and <link linkend="G-IO-FLAG-NONBLOCK:CAPS"><literal>G_IO_FLAG_NONBLOCK</literal></link> masked
out.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GIOFuncs.io-get-flags">io_get_flags</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>gets the <link linkend="GIOFlags"><type>GIOFlags</type></link> for the channel.  This function
need only return the <link linkend="G-IO-FLAG-APPEND:CAPS"><literal>G_IO_FLAG_APPEND</literal></link> and
<link linkend="G-IO-FLAG-NONBLOCK:CAPS"><literal>G_IO_FLAG_NONBLOCK</literal></link> flags; <link linkend="g-io-channel-get-flags"><function>g_io_channel_get_flags()</function></link>
automatically adds the others as appropriate.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>
<refsect2 id="GIOFlags" role="enum">
<title>enum GIOFlags</title>
<indexterm zone="GIOFlags"><primary sortas="IOFlags">GIOFlags</primary></indexterm>
<para>Specifies properties of a <link linkend="GIOChannel"><type>GIOChannel</type></link>. Some of the flags can only be
read with <link linkend="g-io-channel-get-flags"><function>g_io_channel_get_flags()</function></link>, but not changed with
<link linkend="g-io-channel-set-flags"><function>g_io_channel_set_flags()</function></link>.</para>
<refsect3 id="GIOFlags.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-FLAG-APPEND:CAPS">G_IO_FLAG_APPEND</para></entry>
<entry role="enum_member_description"><para>turns on append mode, corresponds to <link linkend="O-APPEND:CAPS"><literal>O_APPEND</literal></link>
(see the documentation of the UNIX <link linkend="open"><function>open()</function></link> syscall)</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-FLAG-NONBLOCK:CAPS">G_IO_FLAG_NONBLOCK</para></entry>
<entry role="enum_member_description"><para>turns on nonblocking mode, corresponds to
<link linkend="O-NONBLOCK:CAPS"><literal>O_NONBLOCK</literal></link>/<link linkend="O-NDELAY:CAPS"><literal>O_NDELAY</literal></link> (see the documentation of the UNIX <link linkend="open"><function>open()</function></link>
syscall)</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-FLAG-IS-READABLE:CAPS">G_IO_FLAG_IS_READABLE</para></entry>
<entry role="enum_member_description"><para>indicates that the io channel is readable.
This flag cannot be changed.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-FLAG-IS-WRITABLE:CAPS">G_IO_FLAG_IS_WRITABLE</para></entry>
<entry role="enum_member_description"><para>indicates that the io channel is writable.
This flag cannot be changed.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-FLAG-IS-WRITEABLE:CAPS">G_IO_FLAG_IS_WRITEABLE</para></entry>
<entry role="enum_member_description"><para>a misspelled version of <parameter>G_IO_FLAG_IS_WRITABLE</parameter>

that existed before the spelling was fixed in GLib 2.30. It is kept
here for compatibility reasons. Deprecated since 2.30</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-FLAG-IS-SEEKABLE:CAPS">G_IO_FLAG_IS_SEEKABLE</para></entry>
<entry role="enum_member_description"><para>indicates that the io channel is seekable,
i.e. that <link linkend="g-io-channel-seek-position"><function>g_io_channel_seek_position()</function></link> can be used on it.
This flag cannot be changed.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-FLAG-MASK:CAPS">G_IO_FLAG_MASK</para></entry>
<entry role="enum_member_description"><para>the mask that specifies all the valid flags.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-FLAG-GET-MASK:CAPS">G_IO_FLAG_GET_MASK</para></entry>
<entry role="enum_member_description"><para>the mask of the flags that are returned from
<link linkend="g-io-channel-get-flags"><function>g_io_channel_get_flags()</function></link></para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-FLAG-SET-MASK:CAPS">G_IO_FLAG_SET_MASK</para></entry>
<entry role="enum_member_description"><para>the mask of the flags that the user can modify
with <link linkend="g-io-channel-set-flags"><function>g_io_channel_set_flags()</function></link></para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GIOError" role="enum">
<title>enum GIOError</title>
<indexterm zone="GIOError"><primary sortas="IOError">GIOError</primary></indexterm>
<para><link linkend="GIOError"><type>GIOError</type></link> is only used by the deprecated functions
<link linkend="g-io-channel-read"><function>g_io_channel_read()</function></link>, <link linkend="g-io-channel-write"><function>g_io_channel_write()</function></link>, and <link linkend="g-io-channel-seek"><function>g_io_channel_seek()</function></link>.</para>
<refsect3 id="GIOError.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-ERROR-NONE:CAPS">G_IO_ERROR_NONE</para></entry>
<entry role="enum_member_description"><para>no error</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-ERROR-AGAIN:CAPS">G_IO_ERROR_AGAIN</para></entry>
<entry role="enum_member_description"><para>an EAGAIN error occurred</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-ERROR-INVAL:CAPS">G_IO_ERROR_INVAL</para></entry>
<entry role="enum_member_description"><para>an EINVAL error occurred</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-IO-ERROR-UNKNOWN:CAPS">G_IO_ERROR_UNKNOWN</para></entry>
<entry role="enum_member_description"><para>another error occurred</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="glib-IO-Channels.see-also">
<title>See Also</title>
<para>g_io_add_watch(), <link linkend="g-io-add-watch-full"><function>g_io_add_watch_full()</function></link>, <link linkend="g-source-remove"><function>g_source_remove()</function></link>,
<link linkend="GMainLoop"><type>GMainLoop</type></link></para>

</refsect1>

</refentry>
