View Single Post

  #1 (permalink)  
Old 07-01-2006, 12:50 AM
Rick Rick is offline
Junior Member
 
Join Date: Jul 2006
Posts: 3
Rep Power: 0
Rick
Default Fix sprintf warning

Hi all,

I can't figure out how to remove a single warning in my project.
Example code:

typedef long long int_64;

void write_integer(int x, int y, int_64 i)
{
char number[35];
sprintf(number, "%u", i);
//code that passes number to string write function
}

When I compile this on linux (gcc with option -Wall) I get the warning:
warning: unsigned int format, different type arg (arg 3)
The sprintf does work for numbers larger then 32 bit though, the output is correct.

Is there a good way to satisfy the compiler?
And if there isn't, is there a way to hide a single warning?

Thank you,
Rick.
Reply With Quote