Header
//#define NO_DEBUG_PRINT
#ifdef NO_DEBUG_PRINT
#define DEBUG_PRINT
#else
static void _PrintDebugString(const WCHAR *format, ...) {
WCHAR buf[1024];
va_list vaList;
va_start(vaList, format);
_vsnwprintf_s(buf, sizeof(buf), format, vaList);
va_end(vaList);
OutputDebugStringW(buf);
}
static void _PrintDebugString(const char *format, ...) {
char buf[1024];
va_list vaList;
va_start(vaList, format);
_vsnprintf_s(buf, sizeof(buf), format, vaList);
va_end(vaList);
OutputDebugStringA(buf);
}
#define DEBUG_PRINT _PrintDebugString
#endif
Source
// Usage examples
DEBUG_PRINT("Hello World: %s", char_string);
DEBUG_PRINT(L"Hello World: %s", wchar_string);