Discovered this trick for the first time. You can use AllocConsole() to redirect ANY std stream to debug console.
In most cases people use either TRACE() statement (but you have include MFC or ATL for that) or Win API OutputDebugString().
With AllocConsole() your code may look like this:
freopen("CONOUT$", "w", stdout);
That’s it!
Learning something new every day. 😀