/****************************************************/
/* ltostr is a temporary function to convert a long */
/* to the corresponding string. */
/****************************************************/
void ltostr(long long source, char *dest)
{
char temp[32];
char *cursor = temp;
int i = 3;
if(source == 0)
{
strcpy(dest, "0");
return;
}
while(source)
{
*cursor = '0' + (source % 10);
cursor++;
source /= 10;
i++;
if(!(i % 3))
{
*cursor = ' ';
cursor++;
}
}
cursor--;
while(cursor >= temp)
{
*dest = *cursor;
cursor--;
dest++;
}
*dest = 0;
}