【问题标题】:DebugView Print Column Displays "????"DebugView 打印列显示“??????”
【发布时间】:2015-03-09 21:46:49
【问题描述】:

在 Windows 7 机器上使用以下代码调用 OutputDebugString 时,我只看到“????”在DebugView的打印栏中。我认为这可能是与编码相关的问题,但不确定是否有人以前见过。这是我用来调用 OutputDebugString 的代码。

void dbgprint(char *format, ...)
{
    static  DWORD pid=0;
    va_list vl;
    char    dbgbuf1[2048],
            dbgbuf2[2048];

    // Prepend the process ID to the message
    if ( 0 == pid )
    {
        pid = GetCurrentProcessId();
    }

    EnterCriticalSection(&gDebugCritSec);
    va_start(vl, format);
    wvsprintf(dbgbuf1, format, vl);
    wsprintf(dbgbuf2, "%lu: %s\r\n", pid, dbgbuf1);
    va_end(vl);

    OutputDebugString(dbgbuf2);
    LeaveCriticalSection(&gDebugCritSec);
}

提前感谢您对此问题的任何见解。

【问题讨论】:

    标签: c++ debugging debugview


    【解决方案1】:

    如您所说,这可能是编码问题。 只需测试它:

    OutputDebugStringA("这是一个非 unicode 测试");

    还有两件事,

    1. 您不必为 PID 添加前缀,因为 OutputDebugString 已经将其与消息一起发送。
    2. https://github.com/djeedjay/DebugViewPP 上查看 DebugView++

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-27
      • 1970-01-01
      • 2021-03-30
      • 2013-04-05
      • 1970-01-01
      • 2017-07-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多