Menu

[r7974]: / branches / mathtex / src / mplutils.cpp  Maximize  Restore  History

Download this file

32 lines (25 with data), 524 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <cstdarg>
#include <cstdio>
#include "mplutils.h"
void _VERBOSE(const std::string& s) {
#ifdef VERBOSE
std::cout << s << std::endl;
#endif
}
Printf::Printf(const char *fmt, ...)
: buffer(new char[1024]) // some reasonably large number
{
va_list ap;
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
va_end(ap); // look ma - I rememberd it this time
}
Printf::~Printf()
{
delete [] buffer;
}
std::ostream &operator<<(std::ostream &o, const Printf &p)
{
return o << p.buffer;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.