Add new format parameters.

This commit is contained in:
Arkshine
2014-07-26 14:40:54 +02:00
parent 47dc226393
commit bbc83291ef
3 changed files with 77 additions and 4 deletions

View File

@ -713,4 +713,22 @@ char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t se
}
return NULL;
}
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
size_t len = vsnprintf(buffer, maxlength, fmt, ap);
va_end(ap);
if (len >= maxlength)
{
buffer[maxlength - 1] = '\0';
return (maxlength - 1);
}
else
{
return len;
}
}