I was looking at topic: How to format a number from 1123456789 to 1,123,456,789 in C?
So I mounted my code based on an existing one.
void printfcomma(char *buf, const char* text int n) {
if (n < 1000) {
sprintf(buf, "%s %d", text, n);
return;
}
printfcomma(buf, n / 1000);
sprintf(buf, "%s ,%03d", text, n %1000);
return;
}
sprintf is only returning the final 3 digits. Example: ,536
Does anyone have any idea why they are not showing the other numbers