Post date: Jan 02, 2017 9:39:37 AM
Lot's of stuff compete for the Console Window e.g. Debug Messages, Real Messages displayed by Computer Program, Input etc.. At times, it is good to have the option to use the Debug Window. Here is how it is done.
#include <stdio.h>
#include <varargs.h>
#include <wchar.h>
void DebugOutput(const WCHAR* szFormat, ...)
{
WCHAR szBuff[1024];
va_list arg;
va_start(arg, szFormat);
_vsnwprintf(szBuff, sizeof(szBuff), szFormat, arg);
va_end(arg);
OutputDebugString(szBuff);
}
Use like
DebugOutput(L"Value of i: %d\n", i);