2
0

CURLOPT_WRITEDATA.3 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_WRITEDATA 3 "16 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_WRITEDATA \- pointer passed to the write callback
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void *pointer);
  32. .fi
  33. .SH DESCRIPTION
  34. A data \fIpointer\fP to pass to the write callback. If you use the
  35. \fICURLOPT_WRITEFUNCTION(3)\fP option, this is the pointer you will get in
  36. that callback's fourth and last argument. If you do not use a write callback,
  37. you must make \fIpointer\fP a 'FILE *' (cast to 'void *') as libcurl will pass
  38. this to \fIfwrite(3)\fP when writing data.
  39. The internal \fICURLOPT_WRITEFUNCTION(3)\fP will write the data to the FILE *
  40. given with this option, or to stdout if this option has not been set.
  41. If you are using libcurl as a win32 DLL, you \fBMUST\fP use a
  42. \fICURLOPT_WRITEFUNCTION(3)\fP if you set this option or you will experience
  43. crashes.
  44. .SH DEFAULT
  45. By default, this is a FILE * to stdout.
  46. .SH PROTOCOLS
  47. Used for all protocols.
  48. .SH EXAMPLE
  49. A common technique is to use the write callback to store the incoming data
  50. into a dynamically growing allocated buffer, and then this
  51. \fICURLOPT_WRITEDATA(3)\fP is used to point to a struct or the buffer to store
  52. data in. Like in the getinmemory example:
  53. https://curl.se/libcurl/c/getinmemory.html
  54. .SH AVAILABILITY
  55. Available in all libcurl versions. This option was formerly known as
  56. \fICURLOPT_FILE\fP, the name \fICURLOPT_WRITEDATA(3)\fP was introduced in
  57. 7.9.7.
  58. .SH RETURN VALUE
  59. This will return CURLE_OK.
  60. .SH "SEE ALSO"
  61. .BR CURLOPT_WRITEFUNCTION "(3), " CURLOPT_READDATA "(3), "