Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <iostream>
  4. #include <Windows.h>
  5.  
  6.  
  7. class debugStreambuf : public std::streambuf {
  8. public:
  9. virtual int_type overflow(int_type c = EOF) {
  10. if (c != EOF) {
  11. TCHAR buf[] = { c, '\0' };
  12. OutputDebugString(buf);
  13. }
  14. return c;
  15. }
  16. };
  17.  
  18. class Cout2VisualStudioDebugOutput {
  19.  
  20. debugStreambuf dbgstream;
  21. std::streambuf *default_stream;
  22.  
  23. public:
  24. Cout2VisualStudioDebugOutput() {
  25. default_stream = std::cout.rdbuf(&dbgstream);
  26. }
  27.  
  28. ~Cout2VisualStudioDebugOutput() {
  29. std::cout.rdbuf(default_stream);
  30. }
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement