On Thursday, 16 May 2019 at 14:53:14 UTC, Alex wrote:
I have some code that disables the console because some other code puts junk on it that I don't want to see... then I enable it.
One thing you could try is going one level lower, and using dup() to save the stream to another fd, close() to close the stdout one, and dup2() to restore the saved fd over the stdout one.