📄 iochannels.sgml
字号:
</row><row><entry><literal>G_IO_CHANNEL_ERROR_NOSPC</literal></entry><entry>No space left on device.</entry></row><row><entry><literal>G_IO_CHANNEL_ERROR_NXIO</literal></entry><entry>No such device or address.</entry></row><row><entry><literal>G_IO_CHANNEL_ERROR_OVERFLOW</literal></entry><entry>Value too large for defined datatype.</entry></row><row><entry><literal>G_IO_CHANNEL_ERROR_PIPE</literal></entry><entry>Broken pipe.</entry></row><row><entry><literal>G_IO_CHANNEL_ERROR_FAILED</literal></entry><entry>Some other error.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="G-IO-CHANNEL-ERROR-CAPS">G_IO_CHANNEL_ERROR</title><programlisting>#define G_IO_CHANNEL_ERROR g_io_channel_error_quark()</programlisting><para>Error domain for <link linkend="GIOChannel">GIOChannel</link> operations. Errors in this domain willbe from the <link linkend="GIOChannelError">GIOChannelError</link> enumeration. See <link linkend="GError">GError</link> for information onerror domains.</para></refsect2><refsect2><title><anchor id="g-io-channel-error-from-errno">g_io_channel_error_from_errno ()</title><programlisting><link linkend="GIOChannelError">GIOChannelError</link> g_io_channel_error_from_errno (<link linkend="gint">gint</link> en);</programlisting><para>Converts an <literal>errno</literal> error number to a <link linkend="GIOChannelError">GIOChannelError</link>.</para><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>en</parameter> :</entry><entry> an <literal>errno</literal> error number, e.g. <literal>EINVAL</literal>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> a <link linkend="GIOChannelError">GIOChannelError</link> error number, e.g. <literal>G_IO_CHANNEL_ERROR_INVAL</literal>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-io-channel-ref">g_io_channel_ref ()</title><programlisting>void g_io_channel_ref (<link linkend="GIOChannel">GIOChannel</link> *channel);</programlisting><para>Increments the reference count of a <link linkend="GIOChannel">GIOChannel</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>channel</parameter> :</entry><entry>a <link linkend="GIOChannel">GIOChannel</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-io-channel-unref">g_io_channel_unref ()</title><programlisting>void g_io_channel_unref (<link linkend="GIOChannel">GIOChannel</link> *channel);</programlisting><para>Decrements the reference count of a <link linkend="GIOChannel">GIOChannel</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>channel</parameter> :</entry><entry>a <link linkend="GIOChannel">GIOChannel</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-io-create-watch">g_io_create_watch ()</title><programlisting><link linkend="GSource">GSource</link>* g_io_create_watch (<link linkend="GIOChannel">GIOChannel</link> *channel, <link linkend="GIOCondition">GIOCondition</link> condition);</programlisting><para>Creates a <link linkend="GSource">GSource</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">G_IO_IN</link>, the source will be dispatchedwhen there's data available for reading. <link linkend="g-io-add-watch">g_io_add_watch</link>() is a simplerinterface to this same functionality, for the case where you want to add thesource to the default main loop at the default priority.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>channel</parameter> :</entry><entry>a <link linkend="GIOChannel">GIOChannel</link> to watch</entry></row><row><entry align="right"><parameter>condition</parameter> :</entry><entry>conditions to watch for</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a new <link linkend="GSource">GSource</link></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-io-add-watch">g_io_add_watch ()</title><programlisting><link linkend="guint">guint</link> g_io_add_watch (<link linkend="GIOChannel">GIOChannel</link> *channel, <link linkend="GIOCondition">GIOCondition</link> condition, <link linkend="GIOFunc">GIOFunc</link> func, <link linkend="gpointer">gpointer</link> user_data);</programlisting><para>Adds the <link linkend="GIOChannel">GIOChannel</link> into the<link linkend="glib-The-Main-Event-Loop">main event loop</link>with the default priority.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>channel</parameter> :</entry><entry>a <link linkend="GIOChannel">GIOChannel</link>.</entry></row><row><entry align="right"><parameter>condition</parameter> :</entry><entry>the condition to watch for.</entry></row><row><entry align="right"><parameter>func</parameter> :</entry><entry>the function to call when the condition is satisfied.</entry></row><row><entry align="right"><parameter>user_data</parameter> :</entry><entry>user data to pass to <parameter>func</parameter>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the event source id.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-io-add-watch-full">g_io_add_watch_full ()</title><programlisting><link linkend="guint">guint</link> g_io_add_watch_full (<link linkend="GIOChannel">GIOChannel</link> *channel, <link linkend="gint">gint</link> priority, <link linkend="GIOCondition">GIOCondition</link> condition, <link linkend="GIOFunc">GIOFunc</link> func, <link linkend="gpointer">gpointer</link> user_data, <link linkend="GDestroyNotify">GDestroyNotify</link> notify);</programlisting><para>Adds the <link linkend="GIOChannel">GIOChannel</link> into the<link linkend="glib-The-Main-Event-Loop">main event loop</link>with the given priority.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>channel</parameter> :</entry><entry>a <link linkend="GIOChannel">GIOChannel</link>.</entry></row><row><entry align="right"><parameter>priority</parameter> :</entry><entry>the priority of the <link linkend="GIOChannel">GIOChannel</link> source.</entry></row><row><entry align="right"><parameter>condition</parameter> :</entry><entry>the condition to watch for.</entry></row><row><entry align="right"><parameter>func</parameter> :</entry><entry>the function to call when the condition is satisfied.</entry></row><row><entry align="right"><parameter>user_data</parameter> :</entry><entry>user data to pass to <parameter>func</parameter>.</entry></row><row><entry align="right"><parameter>notify</parameter> :</entry><entry>the function to call when the source is removed.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the event source id.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GIOCondition">enum GIOCondition</title><programlisting>typedef enum{ G_IO_IN GLIB_SYSDEF_POLLIN, G_IO_OUT GLIB_SYSDEF_POLLOUT, G_IO_PRI GLIB_SYSDEF_POLLPRI, G_IO_ERR GLIB_SYSDEF_POLLERR, G_IO_HUP GLIB_SYSDEF_POLLHUP, G_IO_NVAL GLIB_SYSDEF_POLLNVAL} GIOCondition;</programlisting><para>A bitwise combination representing a condition to watch for on an eventsource.</para><informaltable pgwide="1" frame="none" role="enum"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry><literal>G_IO_IN</literal></entry><entry>There is data to read.</entry></row><row><entry><literal>G_IO_OUT</literal></entry><entry>Data can be written (without blocking).</entry></row><row><entry><literal>G_IO_PRI</literal></entry><entry>There is urgent data to read.</entry></row><row><entry><literal>G_IO_ERR</literal></entry><entry>Error condition.</entry></row><row><entry><literal>G_IO_HUP</literal></entry><entry>Hung up (the connection has been broken, usually for pipes and sockets).</entry></row><row><entry><literal>G_IO_NVAL</literal></entry><entry>Invalid request. The file descriptor is not open.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GIOFunc">GIOFunc ()</title><programlisting><link linkend="gboolean">gboolean</link> (*GIOFunc) (<link linkend="GIOChannel">GIOChannel</link> *source, <link linkend="GIOCondition">GIOCondition</link> condition, <link linkend="gpointer">gpointer</link> data);</programlisting><para>Specifies the type of function passed to <link linkend="g-io-add-watch">g_io_add_watch</link>() or<link linkend="g-io-add-watch-full">g_io_add_watch_full</link>(), which is called when the requested condition on a<link linkend="GIOChannel">GIOChannel</link> is satisfied.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>source</parameter> :</entry><entry>the <link linkend="GIOChannel">GIOChannel</link> event source.</entry></row><row><entry align="right"><parameter>condition</parameter> :</entry><entry>the condition which has been satisfied.</entry></row><row><entry align="right"><parameter>data</parameter> :</entry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -