Re: long int

From: Tel Janin Aellinsar (icarus@Loomis.Berkshire.NET)
Date: 04/02/96


On Tue, 2 Apr 1996, Marcelo Valle Moreira wrote:

>  	Hmmmm, If I'm using a long int arg, I can't use %d to get it 'cause I get the  warning: int format, long int arg.
> 	What can I use instead of %d so I can get rid of exp 0.0000(null) and my display stops with this boring 0.000000H 0.000000M 0.000000V >?

You need to set your column limit to about 75 instead of infinity.

And %f should give you floating point, not %d.  Use this chart:

%d	Short signed int
%u	Short unsigned int
%x	Short unsigned hex int, lowercase (ffff)
%X	Short unsigned hex int, uppercase (FFFF)
%ld	Long signed int (regular int on a 32-bit cc)
%lu	Long unsigned in
%lx	Long unsigned hex int, lowercase (ffffffff)
%lX	Long unsigned hex int, uppercase (FFFFFFFF)
%f	Floating point, dunno the precision
%lf	Long floating point ?
%p	Pointer to variable in memory
	Type depends on cc, usually 32-bit int in form of 0xaddr

Always thought the default precision was 5 (%.5f) but you've got 4 on 
your example.  Well, I've been wrong before, and it changes from cc to cc 
anyway.

But if printf("Experience: %f\n", player->exp) gives you Experience: 
0.0000(null), then you've got SERIOUS problems, way beyond this.  Have 
you got a %p floating around or a %s or something strange like that?  
It's pretty impressive you aren't getting an error on that.  Well, you 
shouldn't use floats without a cast of some kind or the cc may die (or 
just incorrectly convert) on you.  If you must use fp's, try 
printf("Experience: %.0f\n", (double) player->exp) which should at least 
give you something close to the right value.  I think fp's lose precision 
at somewhere around 20 million, though I might be thinking of DOS again.

> 	WidowMaker@jaguari.dcc.unicamp.br 6666
> 

________________________________________________________________________
Tel Janin Aellinsar                       http://www.crocker.com/~icarus
McCoy Enterprises Corporation          Shayol Ghul Resort and Health Spa
Berserker Dragon, Knights of the Cosmos             icarus@BERKSHIRE.NET



This archive was generated by hypermail 2b30 : 12/18/00 PST