|xnprintf is a very small library for
C/C++ compilers, providing asprintf() and snprintf() family
Those functions are very useful to fight against buffer overflow and other nice things of the same kind. They work like printf() and snprintf() but you submit a limit to the size of output text ; you can then safely snprintf() into a buffer without any overflow problem.
nprintf() / vnprintf()
snprintf() / vsnprintf()
fnprintf() / vfnprintf()
asprintf() / vasprintf()
asnprintf() / vasnprintf()
Everything is thread aware (fully re-entrant) i.e you can use it with any multi-threaded system. It works on 32 and 64-bit platforms (and maybe higher). It works on ms-dos/16-bit. It works on Windows (win 3, win95, win98, winNT, win2000, etc). It works on Linux, OpenBSD, FreeBSD, NetBSD and so on. Note that those functions exist since years in a lot of standard libraries.
The source code uses only standard C then it can be used everywhere without any special needs. Just copy and paste the file.
Created by David Taillandier and released under the GNU Public License (GPL) and, at your option, under the modified BSD license.