Re: genshop.c error

From: Welcor (welcor@dune.net)
Date: 11/21/01


----- Original Message -----
From: "Micken !" <micken69@HOTMAIL.COM>
> >Error:
> >
> >gcc -g -O2 -Wall    -c genshp.c -o genshp.o
> >genshp.c: In function `save_shops':
> >genshp.c:476: warning: int format, long int arg (arg 11)
> >
>
> this means, that in one of your printf's, like sprintf or fprintf, you have
> %ld as one of the arguments, but you're putting a normal int into that spot,
> meaning you have to either change it to %d or change the variable to a long
> integer.
>
Nope, the other way around;

sprintf(dummy_buf, "%d blah blah..", some_long_int);

Fix this by either casting the long int as int (this might not be a good idea,
since the long int might be larger than MAX_INT):

sprintf(dummy_buf, "%d blah blah..", (int)some_long_int);

or changing the format string (do it this way):

sprintf(dummy_buf, "%ld blah blah..", some_long_int);

Welcor

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST