I'd like to give my 2 cents.
Given that the maybe is a VS issue about compliancy with the C++ standard or that we could use OutputDebugStringA
, if you cannot modify your code base you may like the idea of simply redirect the std::cout to something else, like a file.
So without changing your code base you can do something like suggested here:How to redirect cin and cout to files?
Condensed:
- add the include
#include <fstream>
- at the beginning of your app, in some init, before logging you can use:
std::ofstream out("out.txt");
std::streambuf *coutbuf = std::cout.rdbuf(); //save old buf
std::cout.rdbuf(out.rdbuf()); //redirect std::cout to out.txt!
- the at the end of your app/logging:
std::cout.rdbuf(coutbuf); //reset to standard output again
Hope this may help someone, Kudos to Nawaz that provided the answer in the other thread.