Is there a better way to pass formatted output to OutputDebugString?
问题 Typically, when I need to do debug output in Windows, I use the following C code segment: #ifdef _DEBUG #define DBGPRINT( kwszDebugFormatString, ... ) \ { \ wprintf_s( L"[%s:%d] ", __FUNCTIONW__, __LINE__ ); \ wprintf_s( kwszDebugFormatString, __VA_ARGS__ ); \ } #else #define DBGPRINT( kwszDebugFormatString, ...) ;; #endif I'd like to recode this to use OutputDebugString which doesn't accept a format string. I consider statically allocating a small array on the stack (e.g., WCHAR wszBuf[100]