Re: g_io_channel_get_buffer_condition



On Mon, 2004-12-06 at 09:12 +0100, Hubert Sokolowski wrote:
Hi!

I use this function to check if I can write to GIOChannel this way
if (!(g_io_channel_get_buffer_condition (io_write) & G_IO_OUT))
  {
    printf ("data cannot be written\n");
    return TRUE;
  }

but the above condition is always true. io_write can be a file or a
pipe.
I can disable this code for a file and then it works fine, but I need
this
for a pipe.
Do I have to use select instead of this function to check if I can write
to a file?

What do you mean "can write to a file" ?
sorry, this was about a pipe. but the problem is solved by setting
G_IO_FLAG_NONBLOCK flag on a channel, now g_io_channel_write_chars returns
with G_IO_STATUS_AGAIN when the channel is full and cannot be written.

anyway, g_io_channel_get_buffer_condition always returns 0, so I don't use
it anymore.

regards
hs




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