xref: /curl/docs/libcurl/opts/CURLOPT_STDERR.md (revision e3fe0200)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_STDERR
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_DEBUGFUNCTION (3)
9  - CURLOPT_NOPROGRESS (3)
10  - CURLOPT_VERBOSE (3)
11Protocol:
12  - All
13---
14
15# NAME
16
17CURLOPT_STDERR - redirect stderr to another stream
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STDERR, FILE *stream);
25~~~
26
27# DESCRIPTION
28
29Pass a FILE * as parameter. Tell libcurl to use this *stream* instead of
30stderr when showing the progress meter and displaying CURLOPT_VERBOSE(3)
31data.
32
33If you are using libcurl as a Windows DLL, this option causes an exception and
34a crash in the library since it cannot access a FILE * passed on from the
35application. A work-around is to instead use CURLOPT_DEBUGFUNCTION(3).
36
37# DEFAULT
38
39stderr
40
41# EXAMPLE
42
43~~~c
44int main(void)
45{
46  CURL *curl = curl_easy_init();
47  FILE *filep = fopen("dump", "wb");
48  if(curl) {
49    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
50    curl_easy_setopt(curl, CURLOPT_STDERR, filep);
51
52    curl_easy_perform(curl);
53  }
54}
55~~~
56
57# AVAILABILITY
58
59Always
60
61# RETURN VALUE
62
63Returns CURLE_OK
64