mexStream.h 480 B

1234567891011121314151617181920
  1. #include <iostream>
  2. namespace igl
  3. {
  4. // http://stackoverflow.com/a/249008/148668
  5. // Class to implement "cout" for mex files to print to the matlab terminal
  6. // window.
  7. //
  8. // Insert at the beginning of mexFunction():
  9. // mexStream mout;
  10. // std::cout.rdbuf(&mout);
  11. //
  12. class mexStream : public std::streambuf
  13. {
  14. public:
  15. protected:
  16. virtual std::streamsize xsputn(const char *s, std::streamsize n);
  17. virtual int overflow(int c = EOF);
  18. };
  19. }