curl_mime_addpart.3 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .\" generated by cd2nroff 0.1 from curl_mime_addpart.md
  2. .TH curl_mime_addpart 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_mime_addpart \- append a new empty part to a mime structure
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. curl_mimepart *curl_mime_addpart(curl_mime *mime);
  9. .fi
  10. .SH DESCRIPTION
  11. \fIcurl_mime_addpart(3)\fP creates and appends a new empty part to the given
  12. mime structure and returns a handle to it. The returned part handle can
  13. subsequently be populated using functions from the mime API.
  14. \fImime\fP is the handle of the mime structure in which the new part must be
  15. appended.
  16. .SH PROTOCOLS
  17. This functionality affects http, imap and smtp
  18. .SH EXAMPLE
  19. .nf
  20. int main(void)
  21. {
  22. curl_mime *mime;
  23. curl_mimepart *part;
  24. CURL *curl = curl_easy_init();
  25. if(curl) {
  26. /* create a mime handle */
  27. mime = curl_mime_init(curl);
  28. /* add a part */
  29. part = curl_mime_addpart(mime);
  30. /* continue and set name + data to the part */
  31. curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED);
  32. curl_mime_name(part, "data");
  33. }
  34. }
  35. .fi
  36. .SH AVAILABILITY
  37. Added in curl 7.56.0
  38. .SH RETURN VALUE
  39. A mime part structure handle, or NULL upon failure.
  40. .SH SEE ALSO
  41. .BR curl_mime_data (3),
  42. .BR curl_mime_data_cb (3),
  43. .BR curl_mime_encoder (3),
  44. .BR curl_mime_filedata (3),
  45. .BR curl_mime_filename (3),
  46. .BR curl_mime_headers (3),
  47. .BR curl_mime_init (3),
  48. .BR curl_mime_name (3),
  49. .BR curl_mime_subparts (3),
  50. .BR curl_mime_type (3)