Hello there,
I want to print a 10 or 11 digit number say 99999999999 with sprintf. For this, I used this code:
Code:
gchar*
convert_value (const gchar *value, gchar type)
{
gchar buff[strlen(value)];
gchar *fstr = malloc (sizeof buff);
int64_t dvalue; double fvalue; <== CHECK HERE
switch (type)
{
case 'd':
dvalue = strtol (value, NULL, 0);
sprintf (buff, "%lld", dvalue); <== AND HERE
break;
case 'f':
fvalue = strtof (value, NULL);
sprintf (buff, "%.2lf", fvalue);
break;
default:
strcpy (buff, value);
}
strcpy (fstr, buff);
return fstr;
}
Usage:
Code:
convert_value ("99999999999", 'd')
But, the output is showing me some other 10 digit numbers probably starting from 2**********.
Please help.
NB: Format specifier "I64d" is also not working.