curl_mprintf.html 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <html><head>
  2. <title>curl_printf man page</title>
  3. <meta name="generator" content="roffit 0.5">
  4. <STYLE type="text/css">
  5. P.level0 {
  6. padding-left: 2em;
  7. }
  8. P.level1 {
  9. padding-left: 4em;
  10. }
  11. P.level2 {
  12. padding-left: 6em;
  13. }
  14. span.emphasis {
  15. font-style: italic;
  16. }
  17. span.bold {
  18. font-weight: bold;
  19. }
  20. span.manpage {
  21. font-weight: bold;
  22. }
  23. h2.nroffsh {
  24. background-color: #e0e0e0;
  25. }
  26. span.nroffip {
  27. font-weight: bold;
  28. font-size: 120%;
  29. font-family: monospace;
  30. }
  31. p.roffit {
  32. text-align: center;
  33. font-size: 80%;
  34. }
  35. </STYLE>
  36. </head><body>
  37. <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
  38. <p class="level0">curl_maprintf, curl_mfprintf, curl_mprintf, curl_msnprintf, curl_msprintf curl_mvaprintf, curl_mvfprintf, curl_mvprintf, curl_mvsnprintf, curl_mvsprintf - formatted output conversion <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
  39. <p class="level0"><span Class="bold">#include &lt;curl/mprintf.h&gt;</span>
  40. <p class="level0"><span Class="bold">int curl_mprintf(const char * format , ...);</span> <span Class="bold">int curl_mfprintf(FILE * fd , const char * format , ...);</span> <span Class="bold">int curl_msprintf(char * buffer , const char * format , ...);</span> <span Class="bold">int curl_msnprintf(char * buffer , size_t maxlength , const char * format , ...);</span> <span Class="bold">int curl_mvprintf(const char * format , va_list args );</span> <span Class="bold">int curl_mvfprintf(FILE * fd , const char * format , va_list args );</span> <span Class="bold">int curl_mvsprintf(char * buffer , const char * format , va_list args );</span> <span Class="bold">int curl_mvsnprintf(char * buffer , size_t maxlength , const char * format , va_list args );</span> <span Class="bold">char *curl_maprintf(const char * format , ...);</span> <span Class="bold">char *curl_mvaprintf(const char * format , va_list args );</span> <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
  41. <p class="level0">These are all functions that produces output according to a format string and given arguments. These are mostly clones of the well-known C-style functions and there will be no detailed explanation of all available formatting rules and usage here.
  42. <p class="level0">See this table for notable exceptions.
  43. <p class="level1">
  44. <p class="level1"><span Class="bold">curl_mprintf()</span> Normal printf() clone.
  45. <p class="level1"><span Class="bold">curl_mfprintf()</span> Normal fprinf() clone.
  46. <p class="level1"><span Class="bold">curl_msprintf()</span> Normal sprintf() clone.
  47. <p class="level1"><span Class="bold">curl_msnprintf()</span> snprintf() clone. Many systems don't have this. It is just like <span Class="bold">sprintf</span> but with an extra argument after the buffer that specifies the length of the target buffer.
  48. <p class="level1"><span Class="bold">curl_mvprintf()</span> Normal vprintf() clone.
  49. <p class="level1"><span Class="bold">curl_mvfprintf()</span> Normal vfprintf() clone.
  50. <p class="level1"><span Class="bold">curl_mvsprintf()</span> Normal vsprintf() clone.
  51. <p class="level1"><span Class="bold">curl_mvsnprintf()</span> vsnprintf() clone. Many systems don't have this. It is just like <span Class="bold">vsprintf</span> but with an extra argument after the buffer that specifies the length of the target buffer.
  52. <p class="level1"><span Class="bold">curl_maprintf()</span> Like printf() but returns the output string as a malloc()ed string. The returned string must be free()ed by the receiver.
  53. <p class="level1"><span Class="bold">curl_mvaprintf()</span> Like curl_maprintf() but takes a va_list pointer argument instead of a variable amount of arguments.
  54. <p class="level0">
  55. <p class="level0">To easily use all these cloned functions instead of the normal ones, #define _MPRINTF_REPLACE before you include the &lt;curl/mprintf.h&gt; file. Then all the normal names like printf, fprintf, sprintf etc will use the curl-functions instead. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
  56. <p class="level0">The <span Class="bold">curl_maprintf</span> and <span Class="bold">curl_mvaprintf</span> functions return a pointer to a newly allocated string, or NULL it it failed.
  57. <p class="level0">All other functions return the number of character they actually outputed. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
  58. <p class="level0"><span Class="manpage">printf (3)</span> <span Class="manpage"> sprintf (3)</span> <span Class="manpage"> fprintf (3)</span> <span Class="manpage"> vprintf (3) </span> <p class="roffit">
  59. This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
  60. </body></html>