Skip to content

Instantly share code, notes, and snippets.

@kaskavalci
Created September 26, 2015 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaskavalci/627e41d45394d349f03b to your computer and use it in GitHub Desktop.
Save kaskavalci/627e41d45394d349f03b to your computer and use it in GitHub Desktop.
int stdout_save;
char buffer[BIG_ENOUGH];
fflush(stdout); //clean everything first
stdout_save = dup(STDOUT_FILENO); //save the stdout state
freopen("NUL", "a", stdout); //redirect stdout to null pointer
setvbuf(stdout, buffer, _IOFBF, 1024); //set buffer to stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment