-
-private:
- int sync() { return file.rdbuf()->pubsync(), coutbuf->pubsync(); }
- int overflow(int c) { return log(coutbuf->sputc((char)c), "<< ") ; }
- int underflow() { return cinbuf->sgetc(); }
- int uflow() { return log(cinbuf->sbumpc(), ">> "); }
-
- int log(int c, const char* prefix) {
-
- static int last = '\n';
-
- if (last == '\n')
- file.rdbuf()->sputn(prefix, 3);
-
- return last = file.rdbuf()->sputc((char)c);
- }
-
-private:
- ofstream file;
- streambuf *cinbuf, *coutbuf;