Re: [gtk-win32] g_io_channel_win32_poll() and pipes....



----- Original Message -----
From: "John Emmas"
>
> I don't seem to be having much success with this problem but I did find
> this similar report in the gnome archives:-
>
http://mail.gnome.org/archives/gtk-list/2009-August/msg00039.html
>
> Tor's explanation is that glib is built using MSVC++6 whose file handles
> won t work with anything later, such as VC++8 or 9. As it happens, I'm
> using 8.
>
But this morning I realised that I still get the problem - even with VC++6.
Here's some very simple code that I wrote to test
g_io_channel_win32_new_fd() with Visual C++

#include <io.h>
#include <fcntl.h>
#include <glib/giochannel.h>

int  hPipes[2];
enum {READ, WRITE};

void SomeFunc()
{
int result = errno;

      result = _pipe (hPipes, 4096, O_BINARY);
      // 'hPipes[READ]' becomes '3' after the above call (stdin,
      // stdout and stderr are presumably 0, 1 and 2)

      GIOChannel* pChan = g_io_channel_win32_new_fd (hPipes[READ]);
      // returns NULL

      result = errno;

      /* Note that 'result' equals zero throughout all the above calls */

      close (hPipes[READ]);
      close (hPipes[WRITE]);
}

The above code returns a NULL pointer for 'pChan' irrespective of whether I
build it using VC++8 or VC++6.  Have I missed a stage out somewhere??  For
example, is there some kind of 'init()' function that I should be calling?

John


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