#include "stdafx.h"
#include <iostream>
#include <sstream>
#ifdef __DEPRECATED
// Make GCC quiet.
# undef __DEPRECATED
# include <strstream>
# define __DEPRECATED
#else
# include <strstream>
#endif
using namespace std;
class LoggerStream : public std::ostrstream {
public:
LoggerStream(char * buf, int len)
: ostrstream(buf, len),
buf_(buf),
len_(len) {
}
~LoggerStream() {
// do the real fucking output
cout << buf_;
}
private:
char *buf_;
int len_;
};
void test()
{
char buf[100] = {'/0'};
LoggerStream(buf, sizeof(buf)) << 1 << " hello world/n";
}
#define LOG_PUTS(log, record) /
do{ /
std::ostringstream os; /
os << record; /
lg->puts(os.str().c_str(), os.str().length()); /
}while(0)
int main() {
test();
return 0;
}