James Millard

sprintf, snprintf and floating point

Discussion created by James Millard on May 2, 2010
Latest reply on May 4, 2010 by CompilerGuru

I know this has been discussed many times and I have read the posts with no luck. 

 

I'm working with an MC9S08QE128.h with Codewarrior (version 5.9 and compiler version 5.0.14).  I'm trying to get sprintf to format  a floating point and not having any luck.  I have:

 

(1) Checked in libdefs.h that LIBDEF_PRINTF_FLOATING is 1. 

(2) I'm using the banked memory model and have include the ANSIBM.A library (float = double = 32 bits)

(3) Gone through all compiler options, "Double is IEEE32" is checked.

 

Is there something else required?

 

Also, where is snprintf()?  I don't normally use sprintf because of overflow issues, but snprintf() doesn't seem be where it's supposed to be (stdio).  The help file says it's there, but a search of stdio.h, does not show a prototype and the linker fails because the symbol "snprintf" is not defined which tells me the code doesn't exist.

 

Thanks for your help.

 

Brad

Outcomes