Per Ola Kristensson | Printf for the Windows debugger

Blog
Publications
Software
Other Stuff

Introduction

This is a convenient function I use to print formatted statements (i.e. printf) to the Windows debugger. It formats the text using vsprintf and then relays the output to the system debugger by passing it to the OutputDebugString function.

Source code

The API is documented in the header file (dbgprintf.h).

dbgprintf.h

License

The code ("dbgprintf") is licensed under the GNU Lesser General Public License.

Example usage

Below is a simple example:

#include <windows.h>
#include "dbgprintf.h"

...

DebugPrintf(TEXT("Ticks: %ld"), GetTickCount());

...