Re: g_io_channel_win32_new_fd()



----- Original Message ----- From: "Tor Lillqvist" <tml iki fi>

If you post sample code, post a *complete* (but minimal) compilable
(single source file) program.

The problem is that I don't know if it's necessary to initialise gtk as a
prerequisite for using glib.  Assuming that's NOT a requirement, here is the
minimum code needed to reproduce the problem (building with VC++6).

Having said that, I still get the same problem, even if I include SomeFunc()
in a simple (but otherwise, fully functioning) gtk app.

The full source code is shown below but I could post the VC++ project as an
attachment if that would be helpful.  Just let me know if you'd prefer a
console app or a (gtk) GUI app.

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

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

void SomeFunc()
{
     int result = _pipe (hPipes, 4096, O_BINARY);

     if (0 == result)
     {
           GIOChannel* pChan = g_io_channel_win32_new_fd (hPipes[READ]);
           // The above call always returns a NULL pointer

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

int main(int argc, char* argv[])
{
     SomeFunc();

     return 0;
}



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