📄 glib-io-channels.html
字号:
<td>a Winsock socket</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" 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="id2930133"></a><h3><a name="g-io-channel-win32-new-messages"></a>g_io_channel_win32_new_messages ()</h3><a class="indexterm" name="id2930147"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>* g_io_channel_win32_new_messages (<a class="link" href="glib-Basic-Types.html#guint">guint</a> hwnd);</pre><p>Creates a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> given a window handle on Windows.</p><p>This function creates a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> that can be used to poll forWindows messages for the window in question.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>hwnd</code></em> :</span></p></td><td>a window handle.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" 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="id2930233"></a><h3><a name="g-io-channel-init"></a>g_io_channel_init ()</h3><a class="indexterm" name="id2930247"></a><pre class="programlisting">void g_io_channel_init (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre><p>Initializes a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> struct. This is called by each of the above functions when creating a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>, and so is not often needed by the application programmer (unless you are creating a new type of <a class="link" 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><p><span class="term"><em class="parameter"><code>channel</code></em> :</span></p></td><td>a <a class="link" 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="id2930327"></a><h3><a name="g-io-channel-new-file"></a>g_io_channel_new_file ()</h3><a class="indexterm" name="id2930340"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>* g_io_channel_new_file (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename, const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *mode, <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Open a file <em class="parameter"><code>filename</code></em> as a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> using mode <em class="parameter"><code>mode</code></em>. Thischannel will be closed when the last reference to it is dropped,so there is no need to call <a class="link" href="glib-IO-Channels.html#g-io-channel-close"><code class="function">g_io_channel_close()</code></a> (though doingso will not cause problems, as long as no attempt is made toaccess the channel after it is closed).</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td><td> A string containing the name of a file</td></tr><tr><td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td><td> One of "r", "w", "a", "r+", "w+", "a+". These have the same meaning as in <code class="function">fopen()</code></td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td><td> A location to return an error of type <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR:CAPS"><code class="literal">G_FILE_ERROR</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> A <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> on success, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2930522"></a><h3><a name="g-io-channel-read-chars"></a>g_io_channel_read_chars ()</h3><a class="indexterm" name="id2930536"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a> g_io_channel_read_chars (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel, <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *buf, <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> count, <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_read, <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Replacement for <a class="link" href="glib-IO-Channels.html#g-io-channel-read"><code class="function">g_io_channel_read()</code></a> with the new API.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>channel</code></em> :</span></p></td><td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td><td> a buffer to read data into</td></tr><tr><td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td><td> 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.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>bytes_read</code></em> :</span></p></td><td> The number of bytes read. This may be zero even on success if count < 6 and the channel's encoding is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. This indicates that the next UTF-8 character is too wide for the buffer.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td><td> a location to return an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a> or <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the status of the operation.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2930737"></a><h3><a name="g-io-channel-read-unichar"></a>g_io_channel_read_unichar ()</h3><a class="indexterm" name="id2930751"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a> g_io_channel_read_unichar (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel, <a class="link" href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> *thechar, <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Reads a Unicode character from <em class="parameter"><code>channel</code></em>.This function cannot be called on a channel with <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> encoding.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>channel</code></em> :</span></p></td><td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>thechar</code></em> :</span></p></td><td> a location to return a character</td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td><td> a location to return an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a> or <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -