Re: How to use GIOChannel to write binary data



Hi silverburgh,

On Sat, 6 Feb 2010 21:00:29 -0800 you wrote:

> In the gio channel,
> http://library.gnome.org/devel/glib/stable/glib-IO-Channels.html#g-io-channel-write,
> there are these api to write characters
> g_io_channel_write_chars
> g_io_channel_write_unichar
> 
> But why there is no api to write binary data? 

Because you don't need one. Binary data is merely a stream of 8-bit chars with no encoding.

> How can i use GIO
> channel to write non-character data?
> 
Look at the documentation for g_io_channel_write_chars and you will find an admittedly cryptic reference to g_io_channel_set_encoding. The documentation for that states:

          The encoding NULL is safe to use with binary data.

I think this answers your question.


Rob


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]