www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dprintf

For those who are using D in VisualStudio.

Small function which does writef into
VisualStudio Output panel.
Very handy for debugging.

version(Windows)
{
  extern (Windows) { export void OutputDebugStringA(char* lpOutputString); }
}

debug void dwritef(...)
{
    char[] s;
    void putc(dchar c)  {  std.utf.encode(s, c);  }
    std.format.doFormat(&putc, _arguments, _argptr);
    version(Windows)  {  OutputDebugStringA(s);  }
} else void dwritef(...) {}

You may send your thanks by CanadaPost :)

Andrew.
Apr 27 2005