If you need to debug a loop or some sort of Window callback, its ridiculously difficult to use breakpoints.
Instead, we can use some formatted output to the debug "Output" window that'll provide us with some handy information.
First, import <crtdbg.h>. This now gives you access to the macros _RPT(), _RPTF(), _RPTW() and _RPTFW(). All of these functions have a similar signature of (reportType, format, [args]).
Each function can also take up to 4 arguments. Simply append a number of 0-4 after the function name to allow for that many number of args. The functions with "W" support wide characters (unicode).
#include <crtdbg.h>
for (int x = 0; x < 10; x++) {
_RPT1(_CRT_WARN, "x = %d\n", x);
//_RPTW1(_CRT_WARN, L"Unicode x = %d\n", x);
}
Will give you this output:
Amazingly helpful and simple, but bloody damn hard to find the exact information online.
[ Source ]