Skip to content

Instantly share code, notes, and snippets.

@tsukkee
Created November 22, 2011 17:12
Show Gist options
  • Save tsukkee/1386238 to your computer and use it in GitHub Desktop.
Save tsukkee/1386238 to your computer and use it in GitHub Desktop.
Macro for OutputDebugString (for Windows)
#include <windows.h>
#include <tchar.h>
#include <sstream>
typedef std::basic_stringstream<TCHAR> tstringstream;
template<typename T> tstringstream& operator,(tstringstream& tss, T t) { tss << _T(" ") << t; return tss; }
#define OUTPUT_DEBUG_STRING(...) ::OutputDebugString((tstringstream(), _T("***"), __VA_ARGS__, _T("\n")).str().c_str());
int main(int argc, char *argv[]) {
OUTPUT_DEBUG_STRING(_T("abc"), 1, 2.3, true); // -> " *** abc 1 2.3 1"
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment