Richard Gipps writes: > I am using the MinGW port of GCC and this doesn't seem to support > dup2().
Sure it does. (dup2() is in the C library, MSVCRT.DLL, the compiler doesn't have much to do with supporting it, except that the headers for the C library, and import libraries, are bundled with it.) dup2() is declared in the <io.h> header. Do you actually get link errors that it isn't found? > Tor which port of the GCC compiler are you using? MinGW. > fd = open ("error.log", O_WRONLY); Hmm, one needs to use O_CREAT, too, and maybe O_TRUNC. (Hey, that was just a code snippet typed in without testing. Yes, I know one shouldn't do that. Note to self: always provide complete, tested, code snippets. Sigh.) I now checked whether the below complete program actually works, and yes it does. Error checking obviously still is missing, so if the open() or dup2() fail for some reason, it will silently fail to work as expected. #include <glib.h> #include <io.h> #include <fcntl.h> int main (int argc, char **argv) { int fd = open ("stdout.log", O_CREAT|O_WRONLY|O_TRUNC, 0666); dup2 (fd, 2); g_message ("blah\n"); return 0; } --tml _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list