From cf11b37bd00fe8bf1193225ebd3ede9df1f5706c Mon Sep 17 00:00:00 2001 From: gunnar_g Date: Tue, 16 Dec 2008 19:14:24 +0000 Subject: [PATCH] Redirect stderr and stdout to a file stderr.txt and stdout.txt respectively --- src/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index b2c3d0e2..2b5d718d 100644 --- a/src/main.c +++ b/src/main.c @@ -30,6 +30,9 @@ #include #include +#include +#include +#include #include "bet_struct.h" #include "debug.h" @@ -324,7 +327,12 @@ main (gint argc, gchar *argv[]) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); #endif - +#ifdef G_OS_WIN32 + int fd1 = open ("stdout.log", O_CREAT|O_WRONLY|O_TRUNC, 0666); + dup2 (fd1, 1); + int fd2 = open ("stderr.log", O_CREAT|O_WRONLY|O_TRUNC, 0666); + dup2 (fd2, 2); +#endif gtk_set_locale (); gtk_init (&argc, &argv);