stream.c

changeset 16
bc9a0fefd892
child 20
43725438ac50
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/stream.c	Tue Sep 20 15:19:28 2011 +0200
     1.3 @@ -0,0 +1,25 @@
     1.4 +/*
     1.5 + * stream.c
     1.6 + *
     1.7 + *  Created on: 20.09.2011
     1.8 + *      Author: beckermi
     1.9 + */
    1.10 +
    1.11 +#include "stream.h"
    1.12 +
    1.13 +void close_stdout() {
    1.14 +#ifdef _WIN32
    1.15 +  _STREAM_STDOUT = dup(STDOUT_FILENO);
    1.16 +#endif
    1.17 +  freopen("/dev/null", "w", stdout);
    1.18 +}
    1.19 +
    1.20 +void reopen_stdout() {
    1.21 +#ifdef _WIN32
    1.22 +  close(STDOUT_FILENO);
    1.23 +  fdopen(dup(_STREAM_STDOUT), "wa");
    1.24 +  close(_STREAM_STDOUT);
    1.25 +#else
    1.26 +  freopen("/dev/stdout", "w", stdout);
    1.27 +#endif
    1.28 +}

mercurial