snprintf.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <html>
  2. <head>
  3. <title>snprintf</title>
  4. <body bgcolor=#ffffff>
  5. <h2 align=center>snprintf</h2>
  6. <h4 align=center>OS/161 Reference Manual</h4>
  7. <h3>Name</h3>
  8. snprintf - print formatted text to string
  9. <h3>Library</h3>
  10. Standard C Library (libc, -lc)
  11. <h3>Synopsis</h3>
  12. #include &lt;unistd.h&gt;<br>
  13. <br>
  14. int<br>
  15. snprintf(char *<em>buf</em>, size_t <em>buflen</em>,
  16. const char *<em>format</em>, ...);<br>
  17. <br>
  18. int<br>
  19. vsnprintf(char *<em>buf</em>, size_t <em>buflen</em>,
  20. const char *<em>format</em>, va_list);<br>
  21. <h3>Description</h3>
  22. snprintf performs <A HREF=printf.html>printf</A>-style formatting on
  23. the string <em>format</em> and subsequent arguments. The resulting
  24. string is placed in <em>buf</em>, which is a memory area at least
  25. <em>buflen</em> bytes long. A null terminator is always added to
  26. <em>buf</em>; the space for this is presumed to be counted in
  27. <em>buflen</em>.
  28. <p>
  29. vsnprintf is the same as snprintf, except that the subsequent
  30. arguments are presumed to have already been collected using the
  31. <A HREF=stdarg.html>stdarg</A> facility.
  32. <p>
  33. <h3>Return Values</h3>
  34. snprintf and vsnprintf return the number of characters printed.
  35. </body>
  36. </html>