int snprintf

int snprintf(char *__s, size_t __n, const char *__fmt,...)

Like sprintf(), but instead of assuming s to be of infinite size, no more than n characters (including the trailing NUL character) will be converted to s.

Returns the number of characters that would have been written to s if there were enough space.