/* * $Id: //devel/tools/main/backstealth/odprintfW.cpp#1 $ * * written by: Stephen J. Friedl * Software Consultant * Tustin, California USA * steve@unixwiz.net * * Given a printf-like argument list, format it into a work buffer, * append a newline, and send it to the system debugger via * OutputDebugString(). This is probably the only way to do output * from within some other process. * * We proactively remove trailing whitespace from the output buffer * and then add a newline. But we don't exit or anything. * * UNICODE VERSION */ #include "bscommon.h" #include #include "bsdefs.h" extern "C" void __cdecl odprintfW(const wchar_t *format, ...) { wchar_t workbuf[1024], *p = workbuf; va_list args; va_start(args, format); p += vswprintf(p, format, args); va_end(args); // strip trailing white while ( p > workbuf && iswspace(p[-1]) ) p--; *p++ = '\n'; *p = '\0'; OutputDebugStringW(workbuf); }