www.pudn.com > xvoice-0.8.1.rar > Error.cc


#include "Error.h"
#include 

#ifndef MIN
#define MIN(a, b)  (((a) < (b)) ? (a) : (b))
#endif

#define MAXMSG 10*1024
void fstring::vappendf(const char* fmt, va_list ap)
{
        char* buf;
        int n = vsnprintf(buf, 0, fmt, ap);
        n = MIN(MAXMSG - size(), n);
        buf = new char[n+1];
        vsnprintf(buf, n+1, fmt, ap);
        append(buf);
        delete buf;
}
void fstring::appendf(const char* fmt, ...)
{
        va_list ap;
        va_start(ap, fmt);
        vappendf(fmt, ap);
        va_end(ap);
}