2015-07-16 02:43 AM
Hello everybody,
Amateur question: I search for a long time how to sprintf a 32bit value in a string. If I usesprintf
(string_to_write,
''%u''
, uint32_value);
The value is cropped as a 16 bit value.
The compiler displays ''
warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t
''' If I usesprintf
(string_to_write,
''%lu''
, uint32_value);
The compiler displays no warning but nothing is printed in my
string_to_write
Do you have any ideas? This is the function of my printf.c librairy:signed
int
sprintf
(
char
*pStr,
const
char
*pFormat, ...)
{
va_list
ap;
signed
int
result;
// Forward call to vsprintf
va_start
(ap, pFormat);
result =
vsprintf
(pStr, pFormat, ap);
va_end
(ap);
return
result;
}
Thanks a lot!