📄 iochannels.sgml
字号:
cases described in the documentation for <link linkend="g-io-channel-set-encoding">g_io_channel_set_encoding</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>channel</parameter> :</entry><entry> a <link linkend="GIOChannel">GIOChannel</link></entry></row><row><entry align="right"><parameter>buf</parameter> :</entry><entry> a buffer to write data from</entry></row><row><entry align="right"><parameter>count</parameter> :</entry><entry> the size of the buffer. If -1, the buffer is taken to be a nul-terminated string.</entry></row><row><entry align="right"><parameter>bytes_written</parameter> :</entry><entry> The number of bytes written. This can be nonzero even if the return value is not <literal>G_IO_STATUS_NORMAL</literal>. If the return value is <literal>G_IO_STATUS_NORMAL</literal> and the channel is blocking, this will always be equal to <parameter>count</parameter> if <parameter>count</parameter> >= 0.</entry></row><row><entry align="right"><parameter>error</parameter> :</entry><entry> A location to return an error of type <link linkend="GConvertError">GConvertError</link> or <link linkend="GIOChannelError">GIOChannelError</link></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the status of the operation.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-io-channel-write-unichar">g_io_channel_write_unichar ()</title><programlisting><link linkend="GIOStatus">GIOStatus</link> g_io_channel_write_unichar (<link linkend="GIOChannel">GIOChannel</link> *channel, <link linkend="gunichar">gunichar</link> thechar, <link linkend="GError">GError</link> **error);</programlisting><para>This function cannot be called on a channel with <literal>NULL</literal> encoding.</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>channel</parameter> :</entry><entry> a <link linkend="GIOChannel">GIOChannel</link></entry></row><row><entry align="right"><parameter>thechar</parameter> :</entry><entry> a character</entry></row><row><entry align="right"><parameter>error</parameter> :</entry><entry> A location to return an error of type <link linkend="GConvertError">GConvertError</link> or <link linkend="GIOChannelError">GIOChannelError</link></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> a <link linkend="GIOStatus">GIOStatus</link></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-io-channel-flush">g_io_channel_flush ()</title><programlisting><link linkend="GIOStatus">GIOStatus</link> g_io_channel_flush (<link linkend="GIOChannel">GIOChannel</link> *channel, <link linkend="GError">GError</link> **error);</programlisting><para>Flushes the write buffer for the GIOChannel.</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>channel</parameter> :</entry><entry> a <link linkend="GIOChannel">GIOChannel</link></entry></row><row><entry align="right"><parameter>error</parameter> :</entry><entry> location to store an error of type <link linkend="GIOChannelError">GIOChannelError</link></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the status of the operation: One of <link linkend="G-IO-CHANNEL-NORMAL-CAPS">G_IO_CHANNEL_NORMAL</link>, <link linkend="G-IO-CHANNEL-AGAIN-CAPS">G_IO_CHANNEL_AGAIN</link>, or <link linkend="G-IO-CHANNEL-ERROR-CAPS">G_IO_CHANNEL_ERROR</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-io-channel-seek-position">g_io_channel_seek_position ()</title><programlisting><link linkend="GIOStatus">GIOStatus</link> g_io_channel_seek_position (<link linkend="GIOChannel">GIOChannel</link> *channel, <link linkend="gint64">gint64</link> offset, <link linkend="GSeekType">GSeekType</link> type, <link linkend="GError">GError</link> **error);</programlisting><para>Replacement for <link linkend="g-io-channel-seek">g_io_channel_seek</link>() with the new API.</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>channel</parameter> :</entry><entry> a <link linkend="GIOChannel">GIOChannel</link></entry></row><row><entry align="right"><parameter>offset</parameter> :</entry><entry> The offset in bytes from the position specified by <parameter>type</parameter></entry></row><row><entry align="right"><parameter>type</parameter> :</entry><entry> a <link linkend="GSeekType">GSeekType</link>. The type <literal>G_SEEK_CUR</literal> is only allowed in those cases where a call to <link linkend="g-io-channel-set-encoding">g_io_channel_set_encoding</link>() is allowed. See the documentation for <link linkend="g-io-channel-set-encoding">g_io_channel_set_encoding</link>() for details.</entry></row><row><entry align="right"><parameter>error</parameter> :</entry><entry> A location to return an error of type <link linkend="GIOChannelError">GIOChannelError</link></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the status of the operation.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GSeekType">enum GSeekType</title><programlisting>typedef enum{ G_SEEK_CUR, G_SEEK_SET, G_SEEK_END} GSeekType;</programlisting><para>An enumeration specifying the base position for a <link linkend="g-io-channel-seek-position">g_io_channel_seek_position</link>()operation.</para><informaltable pgwide="1" frame="none" role="enum"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry><literal>G_SEEK_CUR</literal></entry><entry>the current position in the file.</entry></row><row><entry><literal>G_SEEK_SET</literal></entry><entry>the start of the file.</entry></row><row><entry><literal>G_SEEK_END</literal></entry><entry>the end of the file.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-io-channel-shutdown">g_io_channel_shutdown ()</title><programlisting><link linkend="GIOStatus">GIOStatus</link> g_io_channel_shutdown (<link linkend="GIOChannel">GIOChannel</link> *channel, <link linkend="gboolean">gboolean</link> flush, <link linkend="GError">GError</link> **err);</programlisting><para>Close an IO channel. Any pending data to be written will beflushed if <parameter>flush</parameter> is <literal>TRUE</literal>. The channel will not be freed until thelast reference is dropped using <link linkend="g-io-channel-unref">g_io_channel_unref</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>channel</parameter> :</entry><entry> a <link linkend="GIOChannel">GIOChannel</link></entry></row><row><entry align="right"><parameter>flush</parameter> :</entry><entry> if <literal>TRUE</literal>, flush pending</entry></row><row><entry align="right"><parameter>err</parameter> :</entry><entry> location to store a <link linkend="GIOChannelError">GIOChannelError</link></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the status of the operation.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GIOStatus">enum GIOStatus</title><programlisting>typedef enum{ G_IO_STATUS_ERROR, G_IO_STATUS_NORMAL, G_IO_STATUS_EOF, G_IO_STATUS_AGAIN} GIOStatus;</programlisting><para>Stati returned by most of the <link linkend="GIOFuncs">GIOFuncs</link> functions. </para><informaltable pgwide="1" frame="none" role="enum"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry><literal>G_IO_STATUS_ERROR</literal></entry><entry>An error occurred.</entry></row><row><entry><literal>G_IO_STATUS_NORMAL</literal></entry><entry>Success.</entry></row><row><entry><literal>G_IO_STATUS_EOF</literal></entry><entry>End of file.</entry></row><row><entry><literal>G_IO_STATUS_AGAIN</literal></entry><entry>Resource temporarily unavailable.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GIOChannelError">enum GIOChannelError</title><programlisting>typedef enum{ /* Derived from errno */ G_IO_CHANNEL_ERROR_FBIG, G_IO_CHANNEL_ERROR_INVAL, G_IO_CHANNEL_ERROR_IO, G_IO_CHANNEL_ERROR_ISDIR, G_IO_CHANNEL_ERROR_NOSPC, G_IO_CHANNEL_ERROR_NXIO, G_IO_CHANNEL_ERROR_OVERFLOW, G_IO_CHANNEL_ERROR_PIPE, /* Other */ G_IO_CHANNEL_ERROR_FAILED} GIOChannelError;</programlisting><para>Error codes returned by <link linkend="GIOChannel">GIOChannel</link> operations.</para><informaltable pgwide="1" frame="none" role="enum"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry><literal>G_IO_CHANNEL_ERROR_FBIG</literal></entry><entry>File too large.</entry></row><row><entry><literal>G_IO_CHANNEL_ERROR_INVAL</literal></entry><entry>Invalid argument.</entry></row><row><entry><literal>G_IO_CHANNEL_ERROR_IO</literal></entry><entry>IO error.</entry></row><row><entry><literal>G_IO_CHANNEL_ERROR_ISDIR</literal></entry><entry>File is a directory.</entry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -