Cheap debugging console
Something I keep forgetting and figured I'd put into my blog. If you're looking to add a cheap debug console to your app (just for spewing data) and you're a win32 app, this is a nice little code snippet:
#include "stdio.h" // other window init code goes here // sometime before the main message pump // Create the debug window if( AllocConsole() == true ) { freopen("CONOUT$", "wt", stdout); SetConsoleTitle(L"El-cheapo Debug Window"); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED); } printf( "Debug Window Created!" );
Comments