C99-snprintf

C99-snprintf - Portable implementation of snprintf(3), vsnprintf(3), asprintf(3), and vasprintf(3)
Download

C99-snprintf Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Price:
  • FREE
  • Publisher Name:
  • Holger Weiss
  • Publisher web site:
  • http://www.jhweiss.de/software/snprintf.html
  • Operating Systems:
  • Mac OS X
  • File Size:
  • 91 KB

C99-snprintf Tags


C99-snprintf Description

C99-snprintf - Portable implementation of snprintf(3), vsnprintf(3), asprintf(3), and vasprintf(3) C99-snprintf provides a portable implementation of snprintf(3), vsnprintf(3), asprintf(3), and vasprintf(3). It should be fully C99 compliant, with the exceptions that it doesn't provide wide character support and that %a and %A conversions aren't supported. C99-snprintf should be buildable with any ANSI C compiler, it doesn't require libc functionality other than malloc(3) (for vasprintf(3)) and the stdarg(3) or varargs(3) macros, and it has no other prerequisites.The snprintf(3) and vsnprintf(3) functions are part of the C99 standard library.However, they weren't included in the C89/C90 standards and some systems don't provide C99 compliant implementations of these functions. For example, if the ouput buffer isn't big enough to hold the full conversion result, IRIX up to the current release 6.5.30 and glibc up to 2.0.x don't return the same value as with a sufficiently sized buffer (which makes it impossible to precompute the required buffer size), and some older systems (such as 64-bit Solaris 7) ignore the specified buffer size and overrun the buffer if it's too small. The vasprintf(3) and asprintf(3) functions aren't standardized at all. They're included with recent releases of glibc and BSD's libc, but they aren't available on other systems, such as System V (e.g., Solaris).So, if any of these functions are used, portable software should include replacement code which is used in case the functions aren't available or don't work correctly on the target system. C99-snprintf can be included with software packages in order to provide such replacement functions.


C99-snprintf Related Software