Re: g_message and g_warning under Windows



I am using the MinGW port of GCC and this doesn't seem to support dup2(). Tor which port of the GCC compiler are you using? Is there another way to do this without using dup2() and open()?

At 23:10 14/02/05, you wrote:
Richard Gipps writes:
 > stream = freopen("error.log","w",stderr);
 >
 > g_message("g_message_test");
 > fprintf(stderr,"fprintf_test");

 > which sits in the init function for my main window class.  The fprintf
 > statement works fine, but the g_message() function seems to do nothing.

Hmm, sorry, actually what's needed is not freopen() but a
dup2(). gmessages.c in 2.6 doesn't use stdio on Windows any longer,
but plain write() to file descriptor 1 or 2, like on Unix.

I.e. something like

fd = open ("error.log", O_WRONLY);
dup2 (fd, 2);
g_message ("blah\n");

should work, I hope.

--tml




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