The default encoding for glib.IOChannel is UTF-8. If your application
is reading output from a command using via pipe, you may need to set
the encoding to the encoding of the current locale (see
g_get_charset()) with the g_io_channel_set_encoding() function.
By default, the fd passed will not be closed when the final reference
to the glib.IOChannel data structure is dropped.
If you want to read raw binary data without interpretation, then
call the g_io_channel_set_encoding() function with NULL for the
encoding argument.
This function is available in GLib on Windows, too, but you should
avoid using it on Windows. The domain of file descriptors and
sockets overlap. There is no way for GLib to know which one you mean
in case the argument you pass to this function happens to be both a
valid file descriptor and socket. If that happens a warning is
issued, and GLib assumes that it is the file descriptor you mean.
Creates a new glib.IOChannel given a file descriptor. On UNIX systems this works for plain files, pipes, and sockets.
The returned glib.IOChannel has a reference count of 1.
The default encoding for glib.IOChannel is UTF-8. If your application is reading output from a command using via pipe, you may need to set the encoding to the encoding of the current locale (see g_get_charset()) with the g_io_channel_set_encoding() function. By default, the fd passed will not be closed when the final reference to the glib.IOChannel data structure is dropped.
If you want to read raw binary data without interpretation, then call the g_io_channel_set_encoding() function with NULL for the encoding argument.
This function is available in GLib on Windows, too, but you should avoid using it on Windows. The domain of file descriptors and sockets overlap. There is no way for GLib to know which one you mean in case the argument you pass to this function happens to be both a valid file descriptor and socket. If that happens a warning is issued, and GLib assumes that it is the file descriptor you mean.