Author: Heiner Marxen
Date: 12:37:50 12/07/01
Go up one level in this thread
On December 07, 2001 at 11:12:22, Sune Fischer wrote:
>Wups, reverse that, the logic was bad before.
>
>char *PrintInt64(long64 x, char *s)
>{
>int MEGA=1000000;
>long64 a = x/((long64) MEGA);
>long64 b = x%((long64) MEGA);
>
> if (a==0)
> {
> sprintf(s,"%d",b);
> return(s);
> }
Does nobody anymore know how to use printf?
> if (b<MEGA/100000) sprintf(s,"%d00000%d",a,b);
> else if (b<MEGA/10000) sprintf(s,"%d0000%d",a,b);
> else if (b<MEGA/1000) sprintf(s,"%d000%d",a,b);
> else if (b<MEGA/100) sprintf(s,"%d00%d",a,b);
> else if (b<MEGA/10) sprintf(s,"%d0%d",a,b);
> else if (b>=MEGA/10) sprintf(s,"%d%d",a,b);
> else sprintf(s,"Error in PrintInt64");
sprintf(s, "%d%06d", (int)a, (int)b);
replaces all 7 lines.
Heiner
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.