📄 glib-io-channels.html
字号:
</p></div><hr><div class="refsect2" lang="en"><a name="id2911787"></a><h3><a name="g-io-channel-error-from-errno"></a>g_io_channel_error_from_errno ()</h3><a class="indexterm" name="id2911798"></a><pre class="programlisting"><a href="glib-IO-Channels.html#GIOChannelError">GIOChannelError</a> g_io_channel_error_from_errno (<a href="glib-Basic-Types.html#gint">gint</a> en);</pre><p>Converts an <code class="literal">errno</code> error number to a <a href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>en</code></em> :</span></td><td> an <code class="literal">errno</code> error number, e.g. <code class="literal">EINVAL</code>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a <a href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a> error number, e.g. <code class="literal">G_IO_CHANNEL_ERROR_INVAL</code>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2911900"></a><h3><a name="g-io-channel-ref"></a>g_io_channel_ref ()</h3><a class="indexterm" name="id2911910"></a><pre class="programlisting"><a href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>* g_io_channel_ref (<a href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre><p>Increments the reference count of a <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>channel</code></em> :</span></td><td>a <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the <em class="parameter"><code>channel</code></em> that was passed in (since 2.6)</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2911988"></a><h3><a name="g-io-channel-unref"></a>g_io_channel_unref ()</h3><a class="indexterm" name="id2912000"></a><pre class="programlisting">void g_io_channel_unref (<a href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre><p>Decrements the reference count of a <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>channel</code></em> :</span></td><td>a <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2912062"></a><h3><a name="g-io-create-watch"></a>g_io_create_watch ()</h3><a class="indexterm" name="id2912073"></a><pre class="programlisting"><a href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* g_io_create_watch (<a href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel, <a href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition);</pre><p>Creates a <a href="glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> that's dispatched when <em class="parameter"><code>condition</code></em> is met for the given<em class="parameter"><code>channel</code></em>. For example, if condition is <span class="type">G_IO_IN</span>, the source will be dispatchedwhen there's data available for reading. <a href="glib-IO-Channels.html#g-io-add-watch"><code class="function">g_io_add_watch()</code></a> 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.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>channel</code></em> :</span></td><td>a <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> to watch</td></tr><tr><td><span class="term"><em class="parameter"><code>condition</code></em> :</span></td><td>conditions to watch for</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a new <a href="glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2912212"></a><h3><a name="g-io-add-watch"></a>g_io_add_watch ()</h3><a class="indexterm" name="id2912222"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a> g_io_add_watch (<a href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel, <a href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition, <a href="glib-IO-Channels.html#GIOFunc">GIOFunc</a> func, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Adds the <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> into the<a href="glib-The-Main-Event-Loop.html" title="The Main Event Loop">main event loop</a>with the default priority.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>channel</code></em> :</span></td><td>a <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>condition</code></em> :</span></td><td>the condition to watch for.</td></tr><tr><td><span class="term"><em class="parameter"><code>func</code></em> :</span></td><td>the function to call when the condition is satisfied.</td></tr><tr><td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td><td>user data to pass to <em class="parameter"><code>func</code></em>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the event source id.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2912375"></a><h3><a name="g-io-add-watch-full"></a>g_io_add_watch_full ()</h3><a class="indexterm" name="id2912386"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a> g_io_add_watch_full (<a href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel, <a href="glib-Basic-Types.html#gint">gint</a> priority, <a href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition, <a href="glib-IO-Channels.html#GIOFunc">GIOFunc</a> func, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data, <a href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> notify);</pre><p>Adds the <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> into the<a href="glib-The-Main-Event-Loop.html" title="The Main Event Loop">main event loop</a>with the given priority.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>channel</code></em> :</span></td><td>a <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>priority</code></em> :</span></td><td>the priority of the <a href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> source.</td></tr><tr><td><span class="term"><em class="parameter"><code>condition</code></em> :</span></td><td>the condition to watch for.</td></tr><tr><td><span class="term"><em class="parameter"><code>func</code></em> :</span></td><td>the function to call when the condition is satisfied.</td></tr><tr><td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td><td>user data to pass to <em class="parameter"><code>func</code></em>.</td></tr><tr><td><span class="term"><em class="parameter"><code>notify</code></em> :</span></td><td>the function to call when the source is removed.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the event source id.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2912590"></a><h3><a name="GIOCondition"></a>enum GIOCondition</h3><a class="indexterm" name="id2912601"></a><pre class="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;</pre><p>A bitwise combination representing a condition to watch for on an eventsource.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><code class="literal">G_IO_IN</code></span></td><td>There is data to read.</td></tr><tr><td><span class="term"><code
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -