There are countless articles and answers online explaining how to redirect standard output, like this or this. However, I want to duplicate/mirror what is written to stdout/stderr without completely redirecting it. When I do a printf or an std::cout, I want it to simultaneously write to the console and to a file. This is a plugin of sorts; I do not have control over when or how the process calls printf/std::cout/etc. I only need to support Windows. I sort of want something like Boost's tee device but that somehow uses stdout. Is this possible?
Edit: I wonder if the people who closed this really understood what I am asking, or if I am missing something? I don't want to duplicate the std::cout stream buffer, I want to duplicate standard output. None of those answers linked in the "duplicate" question link could intercept/duplicate a call to printf.