/* * $Id: //devel/tools/main/backstealth/odprintfA.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. * * ANSI VERSION */ #include "bscommon.h" #include #include "bsdefs.h" extern "C" void __cdecl odprintfA(const char *format, ...) { char workbuf[1024], *p = workbuf; va_list args; va_start(args, format); p += vsprintf(p, format, args); va_end(args); // strip trailing white while ( p > workbuf && isspace(p[-1]) ) p--; *p++ = '\n'; *p = '\0'; OutputDebugStringA(workbuf); }