I have an idea to do it with walking up the va_list and computing how many characters each variable's value would need to display, and then creating a character array with that number. If I'm making no sense, heres an example:
Code: Select all
char newstr[kstrlen(str) + knumlen_baseten(integer) + 1]; //1 for the \0
kstrcpy(newstr, str);
kdrawstr(newstr, 0, 0, BLACK, WHITE);
Code: Select all
uint8 knumlen_baseten(uint32 number)
{
uint8 number_of_digits = 0;
while ((number /= 10) > 0)
{
number_of_digits++;
}
return (number_of_digits+1);
}
Thanks!!