>38
大分前に書いたコードから抜粋してきたけどこれでそれなりに動かない?

#include <iostream>
#include <sstream>
#include <windows.h>

class odstringbuf : public std::stringbuf
{
protected:
  virtual int sync(void) {
    OutputDebugString(str().c_str());
    str("");
    return 0;
  }
};

int main(void) {
  odstringbuf odsbuf;
  std::ostream ods(&odsbuf);

  ods << "debug log" << std::endl;
  return 0;
}