This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: snprintf and malloc


On Tue, 2017-12-05 at 15:47 -0500, Trampas Stern wrote:
> It looks like the best option is to implement my own snprintf() and
> avoid
> using newlib's.

Not the best approach in my opinion.

You may always use sniprintf(), which does _NOT_ support any floating
point formats, but it also does _NOT_ use malloc(). Generally in newlib
there are non-floating-point variants of all printf- and scanf-like
functions - just add the "i" right before printf/scanf and you are
done. For example there is iprintf, siprintf, sniprintf, viprintf and
so on.

Regards,
FCh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]