Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/gtk-doc/html/glib/ drwxr-xr-x |
Viewing file: Select action/file-type:
Synopsis#include <glib.h> GIOChannel; GIOChannel* g_io_channel_unix_new (int fd); gint g_io_channel_unix_get_fd (GIOChannel *channel); void g_io_channel_init (GIOChannel *channel); GIOChannel* g_io_channel_new_file (const gchar *filename, const gchar *mode, GError **error); GIOStatus g_io_channel_read_chars (GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read, GError **error); GIOStatus g_io_channel_read_unichar (GIOChannel *channel, gunichar *thechar, GError **error); GIOStatus g_io_channel_read_line (GIOChannel *channel, gchar **str_return, gsize *length, gsize *terminator_pos, GError **error); GIOStatus g_io_channel_read_line_string (GIOChannel *channel, GString *buffer, gsize *terminator_pos, GError **error); GIOStatus g_io_channel_read_to_end (GIOChannel *channel, gchar **str_return, gsize *length, GError **error); GIOStatus g_io_channel_write_chars (GIOChannel *channel, const gchar *buf, gssize count, gsize *bytes_written, GError **error); GIOStatus g_io_channel_write_unichar (GIOChannel *channel, gunichar thechar, GError **error); GIOStatus g_io_channel_flush (GIOChannel *channel, GError **error); GIOStatus g_io_channel_seek_position (GIOChannel *channel, gint64 offset, GSeekType type, GError **error); enum GSeekType; GIOStatus g_io_channel_shutdown (GIOChannel *channel, gboolean flush, GError **err); enum GIOStatus; enum GIOChannelError; #define G_IO_CHANNEL_ERROR GIOChannelError g_io_channel_error_from_errno (gint en); GIOChannel* g_io_channel_ref (GIOChannel *channel); void g_io_channel_unref (GIOChannel *channel); GSource* g_io_create_watch (GIOChannel *channel, GIOCondition condition); guint g_io_add_watch (GIOChannel *channel, GIOCondition condition, GIOFunc func, gpointer user_data); guint g_io_add_watch_full (GIOChannel *channel, gint priority, GIOCondition condition, GIOFunc func, gpointer user_data, GDestroyNotify notify); enum GIOCondition; gboolean (*GIOFunc) (GIOChannel *source, GIOCondition condition, gpointer data); GIOFuncs; gsize g_io_channel_get_buffer_size (GIOChannel *channel); void g_io_channel_set_buffer_size (GIOChannel *channel, gsize size); GIOCondition g_io_channel_get_buffer_condition (GIOChannel *channel); GIOFlags g_io_channel_get_flags (GIOChannel *channel); GIOStatus g_io_channel_set_flags (GIOChannel *channel, GIOFlags flags, GError **error); enum GIOFlags; const gchar* g_io_channel_get_line_term (GIOChannel *channel, gint *length); void g_io_channel_set_line_term (GIOChannel *channel, const gchar *line_term, gint length); gboolean g_io_channel_get_buffered (GIOChannel *channel); void g_io_channel_set_buffered (GIOChannel *channel, gboolean buffered); const gchar* g_io_channel_get_encoding (GIOChannel *channel); GIOStatus g_io_channel_set_encoding (GIOChannel *channel, const gchar *encoding, GError **error); gboolean g_io_channel_get_close_on_unref (GIOChannel *channel); void g_io_channel_set_close_on_unref (GIOChannel *channel, gboolean do_close); GIOError g_io_channel_read (GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read); enum GIOError; GIOError g_io_channel_write (GIOChannel *channel, const gchar *buf, gsize count, gsize *bytes_written); GIOError g_io_channel_seek (GIOChannel *channel, gint64 offset, GSeekType type); void g_io_channel_close (GIOChannel *channel); DescriptionThe GIOChannel data type aims to provide a portable method for using file descriptors, pipes, and sockets, and integrating them into the main event loop. Currently full support is available on UNIX platforms, support for Windows is only partially complete.
To create a new GIOChannel on UNIX systems use
Once a GIOChannel has been created, it can be used in a generic manner
with the functions
To add a GIOChannel to the
main event loop
use
GIOChannel instances are created with an initial reference count of 1.
The new functions DetailsGIOChanneltypedef struct { } GIOChannel; A data structure representing an IO Channel. The fields should be considered private and should only be accessed with the following functions. g_io_channel_unix_new ()GIOChannel* g_io_channel_unix_new (int fd); Creates a new GIOChannel given a file descriptor. On UNIX systems this works for plain files, pipes, and sockets. The returned GIOChannel has a reference count of 1.
The default encoding for GIOChannel 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
If you want to read raw binary data without interpretation, then
call the
g_io_channel_unix_get_fd ()gint g_io_channel_unix_get_fd (GIOChannel *channel); Returns the file descriptor of the UNIX GIOChannel.
g_io_channel_init ()void g_io_channel_init (GIOChannel *channel); Initializes a GIOChannel struct. This is called by each of the above functions when creating a GIOChannel, and so is not often needed by the application programmer (unless you are creating a new type of GIOChannel).
g_io_channel_new_file ()GIOChannel* g_io_channel_new_file (const gchar *filename, const gchar *mode, GError **error);
Open a file
g_io_channel_read_chars ()GIOStatus g_io_channel_read_chars (GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read, GError **error);
Replacement for
g_io_channel_read_unichar ()GIOStatus g_io_channel_read_unichar (GIOChannel *channel, gunichar *thechar, GError **error);
This function cannot be called on a channel with
g_io_channel_read_line ()GIOStatus g_io_channel_read_line (GIOChannel *channel, gchar **str_return, gsize *length, gsize *terminator_pos, GError **error);
Reads a line, including the terminating character(s),
from a GIOChannel into a newly-allocated string.
g_io_channel_read_line_string ()GIOStatus g_io_channel_read_line_string (GIOChannel *channel, GString *buffer, gsize *terminator_pos, GError **error); Reads a line from a GIOChannel, using a GString as a buffer.
g_io_channel_read_to_end ()GIOStatus g_io_channel_read_to_end (GIOChannel *channel, gchar **str_return, gsize *length, GError **error); Reads all the remaining data from the file.
g_io_channel_write_chars ()GIOStatus g_io_channel_write_chars (GIOChannel *channel, const gchar *buf, gssize count, gsize *bytes_written, GError **error);
Replacement for
On seekable channels with encodings other than
g_io_channel_write_unichar ()GIOStatus g_io_channel_write_unichar (GIOChannel *channel, gunichar thechar, GError **error);
This function cannot be called on a channel with
g_io_channel_flush ()GIOStatus g_io_channel_flush (GIOChannel *channel, GError **error); Flushes the write buffer for the GIOChannel.
g_io_channel_seek_position ()GIOStatus g_io_channel_seek_position (GIOChannel *channel, gint64 offset, GSeekType type, GError **error);
Replacement for
enum GSeekTypetypedef enum { G_SEEK_CUR, G_SEEK_SET, G_SEEK_END } GSeekType;
An enumeration specifying the base position for a
g_io_channel_shutdown ()GIOStatus g_io_channel_shutdown (GIOChannel *channel, gboolean flush, GError **err);
Close an IO channel. Any pending data to be written will be
flushed if
enum GIOStatustypedef enum { G_IO_STATUS_ERROR, G_IO_STATUS_NORMAL, G_IO_STATUS_EOF, G_IO_STATUS_AGAIN } GIOStatus; Stati returned by most of the GIOFuncs functions.
enum GIOChannelErrortypedef 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; Error codes returned by GIOChannel operations.
G_IO_CHANNEL_ERROR#define G_IO_CHANNEL_ERROR g_io_channel_error_quark() Error domain for GIOChannel operations. Errors in this domain will be from the GIOChannelError enumeration. See GError for information on error domains. g_io_channel_error_from_errno ()GIOChannelError g_io_channel_error_from_errno (gint en);
Converts an
g_io_channel_ref ()GIOChannel* g_io_channel_ref (GIOChannel *channel); Increments the reference count of a GIOChannel.
g_io_channel_unref ()void g_io_channel_unref (GIOChannel *channel); Decrements the reference count of a GIOChannel.
g_io_create_watch ()GSource* g_io_create_watch (GIOChannel *channel, GIOCondition condition);
Creates a GSource that's dispatched when
g_io_add_watch ()guint g_io_add_watch (GIOChannel *channel, GIOCondition condition, GIOFunc func, gpointer user_data); Adds the GIOChannel into the main event loop with the default priority.
g_io_add_watch_full ()guint g_io_add_watch_full (GIOChannel *channel, gint priority, GIOCondition condition, GIOFunc func, gpointer user_data, GDestroyNotify notify); Adds the GIOChannel into the main event loop with the given priority.
enum GIOConditiontypedef 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; A bitwise combination representing a condition to watch for on an event source.
GIOFunc ()gboolean (*GIOFunc) (GIOChannel *source, GIOCondition condition, gpointer data);
Specifies the type of function passed to
GIOFuncstypedef struct { GIOStatus (*io_read) (GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read, GError **err); GIOStatus (*io_write) (GIOChannel *channel, const gchar *buf, gsize count, gsize *bytes_written, GError **err); GIOStatus (*io_seek) (GIOChannel *channel, gint64 offset, GSeekType type, GError **err); GIOStatus (*io_close) (GIOChannel *channel, GError **err); GSource* (*io_create_watch) (GIOChannel *channel, GIOCondition condition); void (*io_free) (GIOChannel *channel); GIOStatus (*io_set_flags) (GIOChannel *channel, GIOFlags flags, GError **err); GIOFlags (*io_get_flags) (GIOChannel *channel); } GIOFuncs; A table of functions used to handle different types of GIOChannel in a generic way. g_io_channel_get_buffer_size ()gsize g_io_channel_get_buffer_size (GIOChannel *channel); Gets the buffer size.
g_io_channel_set_buffer_size ()void g_io_channel_set_buffer_size (GIOChannel *channel, gsize size); Sets the buffer size.
g_io_channel_get_buffer_condition ()GIOCondition g_io_channel_get_buffer_condition (GIOChannel *channel);
This function returns a GIOCondition depending on whether there
is data to be read/space to write data in the
internal buffers in the GIOChannel. Only the flags
g_io_channel_get_flags ()GIOFlags g_io_channel_get_flags (GIOChannel *channel);
Gets the current flags for a GIOChannel, including read-only
flags such as
The values of the flags
g_io_channel_set_flags ()GIOStatus g_io_channel_set_flags (GIOChannel *channel, GIOFlags flags, GError **error);
Sets the (writeable) flags in
enum GIOFlagstypedef enum { G_IO_FLAG_APPEND = 1 << 0, G_IO_FLAG_NONBLOCK = 1 << 1, G_IO_FLAG_IS_READABLE = 1 << 2, /* Read only flag */ G_IO_FLAG_IS_WRITEABLE = 1 << 3, /* Read only flag */ G_IO_FLAG_IS_SEEKABLE = 1 << 4, /* Read only flag */ G_IO_FLAG_MASK = (1 << 5) - 1, G_IO_FLAG_GET_MASK = G_IO_FLAG_MASK, G_IO_FLAG_SET_MASK = G_IO_FLAG_APPEND | G_IO_FLAG_NONBLOCK } GIOFlags;
Specifies properties of a GIOChannel. Some of the flags can only
be read with
g_io_channel_get_line_term ()const gchar* g_io_channel_get_line_term (GIOChannel *channel, gint *length);
This returns the string that GIOChannel uses to determine
where in the file a line break occurs. A value of
g_io_channel_set_line_term ()void g_io_channel_set_line_term (GIOChannel *channel, const gchar *line_term, gint length); This sets the string that GIOChannel uses to determine where in the file a line break occurs.
g_io_channel_get_buffered ()gboolean g_io_channel_get_buffered (GIOChannel *channel);
Returns whether
g_io_channel_set_buffered ()void g_io_channel_set_buffered (GIOChannel *channel, gboolean buffered);
The buffering state can only be set if the channel's encoding
is
A buffered channel can only be set unbuffered if the channel's
internal buffers have been flushed. Newly created channels or
channels which have returned On unbuffered channels, it is safe to mix read and write calls from the new and old APIs, if this is necessary for maintaining old code. The default state of the channel is buffered.
g_io_channel_get_encoding ()const gchar* g_io_channel_get_encoding (GIOChannel *channel);
Gets the encoding for the input/output of the channel. The internal
encoding is always UTF-8. The encoding
g_io_channel_set_encoding ()GIOStatus g_io_channel_set_encoding (GIOChannel *channel, const gchar *encoding, GError **error); Sets the encoding for the input/output of the channel. The internal encoding is always UTF-8. The default encoding for the external file is UTF-8.
The encoding The encoding can only be set if one of the following conditions is true: 1. The channel was just created, and has not been written to or read from yet. 2. The channel is write-only.
3. The channel is a file, and the file pointer was just
repositioned by a call to
4. The current encoding is
5. One of the (new API) read functions has just returned
6. One of the functions
Channels which do not meet one of the above conditions cannot call
g_io_channel_get_close_on_unref ()gboolean g_io_channel_get_close_on_unref (GIOChannel *channel);
Returns whether the file/socket/whatever associated with
g_io_channel_set_close_on_unref ()void g_io_channel_set_close_on_unref (GIOChannel *channel, gboolean do_close);
Setting this flag to
g_io_channel_read ()GIOError g_io_channel_read (GIOChannel *channel, gchar *buf, gsize count, gsize *bytes_read); Warning
Reads data from a GIOChannel.
enum GIOErrortypedef enum { G_IO_ERROR_NONE, G_IO_ERROR_AGAIN, G_IO_ERROR_INVAL, G_IO_ERROR_UNKNOWN } GIOError;
GIOError is only used by the deprecated functions g_io_channel_write ()GIOError g_io_channel_write (GIOChannel *channel, const gchar *buf, gsize count, gsize *bytes_written); Warning
Writes data to a GIOChannel.
g_io_channel_seek ()GIOError g_io_channel_seek (GIOChannel *channel, gint64 offset, GSeekType type); Warning
Sets the current position in the GIOChannel, similar to the standard library
function
g_io_channel_close ()void g_io_channel_close (GIOChannel *channel); Warning
Close an IO channel. Any pending data to be written will be
flushed, ignoring errors. The channel will not be freed until the
last reference is dropped using
See Also
|
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0049 ]-- |