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