Hi,
Code:
char format[64] = "1.51480724077861e-03";
char buffer[64] = "";
int number = 0;
printf("format [%s]\n", format);
if(sscanf(format, "%s", &buffer) == 1)
{
number = sprintf(format, "%031.15f", atof(buffer));
}
printf("return from sprintf [%d]\n", number);
printf("format [%s]\n", format);
/* OUTPUT */
[1.51480724077861e-03]
[31]
[000000000000000.001514807240779]
If I wanted the to establish the first whole number before the decimal place, what could I use ?
In the above example, the preferred output would be 0.001514807240779
tia,