次のコードを使用して 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);
}
この問題についての洞察を事前に感謝します。