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