void wcsutil_double2str(char *buf, const char *format, double value) { char *bp, *cp; sprintf(buf, format, value); wcsutil_locale_to_dot(buf); /* Look for a decimal point or exponent. */ bp = buf; while (*bp) { if (*bp != ' ') { if (*bp == '.') return; if (*bp == 'e') return; if (*bp == 'E') return; } bp++; } /* Not found, add a fractional part. */ bp = buf; if (*bp == ' ') { cp = buf + 1; if (*cp == ' ') cp++; while (*cp) { *bp = *cp; bp++; cp++; } *bp = '.'; bp++; if (bp < cp) *bp = '0'; } }
void wcsutil_double2str(char *buf, const char *format, double value) { sprintf(buf, format, value); wcsutil_locale_to_dot(buf); }