Beispiel #1
0
//---------------------------------------------------------------------------
tjs_int TJS_cdecl tTJSString::printf(const tjs_char *format, ...)
{
	tjs_int r;
	tjs_char *buf = new tjs_char [TJS_TTSTR_SPRINTF_BUF_SIZE];
	try
	{
		tjs_int size = TJS_TTSTR_SPRINTF_BUF_SIZE-1; /*TJS_vsnprintf(NULL, 0, format, param);*/
		va_list param;
		va_start(param, format);
		r = TJS_vsnprintf(buf, size, format, param);
		AllocBuffer(r);
		if(r)
		{
			TJS_strcpy(const_cast<tjs_char*>(c_str()), buf);
		}
		va_end(param);
		FixLen();
	}
	catch(...)
	{
		delete [] buf;
		throw;
	}
	delete [] buf;
	return r;
}
Beispiel #2
0
tjs_int TJS_sprintf(tjs_char *s, const tjs_char *format, ...)
{
	tjs_int r;
	va_list param;
	va_start(param, format);
	r = TJS_vsnprintf(s, INT_MAX, format, param);
	va_end(param);
	return r;
}
Beispiel #3
0
int wnsprintf(wchar_t *buf, unsigned int size, wchar_t *format, ... )
{
    int r;
    va_list param;
    va_start(param, format);
    r = TJS_vsnprintf(buf, INT_MAX, format, param);
    va_end(param);
    return r;
}