clib2 has separate versions of the printf and scanf functions in libc and libm. The libc versions are shorter because they do not support floating point data, and therefore do not pull in the floating support code.
If you need floating point support in printf and scanf, then you will need to link with libm before libc is used, e.g. "gcc -o example example.c -lm -lc" rather than just use "gcc -o example example.c".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Are you sure that this is not working as advertized? The whole printf family is part of libm, which includes the snprintf() function that's not actually part of ISO 'C' (1994), but of C99.
A program such as this ought to work (I tested clib2 version 1.205 for 68k):
clib2 has separate versions of the printf and scanf functions in libc and libm. The libc versions are shorter because they do not support floating point data, and therefore do not pull in the floating support code.
If you need floating point support in printf and scanf, then you will need to link with libm before libc is used, e.g. "gcc -o example example.c -lm -lc" rather than just use "gcc -o example example.c".
Now I need snprintf. Can you add it's float version to libm, please ?
Last edit: apj 2015-01-25
Are you sure that this is not working as advertized? The whole printf family is part of libm, which includes the snprintf() function that's not actually part of ISO 'C' (1994), but of C99.
A program such as this ought to work (I tested clib2 version 1.205 for 68k):
I saved this program to disk and compiled it with "gcc -o test test.c -lm -lc". Running it produced the output "float = 123.456000".