// 使用OutputDebugString很不方便.不能自定义格式化输出.所以重写了一下.

#include <tchar.h>
#include <windows.h>


void __cdecl MyOutputDebugStrig(const _TCHAR* pszFormat, ...)
{
    _TCHAR buf[1024] = { 0 };
    // ZeroMemory( buf, 1024*sizeof(TCHAR ) );
    swprintf_s(buf, 1024, _T("线程ID = [%lu]"), GetCurrentThreadId());
    va_list arglist;
    va_start(arglist, pszFormat);
    int nBuffSize = _tcslen(buf);
    vswprintf_s(&buf[nBuffSize], 1024 - nBuffSize, pszFormat, arglist);
    va_end(arglist);
    nBuffSize = _tcslen(buf);
    _tcscat_s(buf, 1024 - nBuffSize, _T("\n"));
    OutputDebugString(buf);
}
注意,请使用UNICODE字符集.
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。