CURLOPT_STDERR.md (1344B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_STDERR 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_DEBUGFUNCTION (3) 9 - CURLOPT_NOPROGRESS (3) 10 - CURLOPT_VERBOSE (3) 11 Protocol: 12 - All 13 Added-in: 7.1 14 --- 15 16 # NAME 17 18 CURLOPT_STDERR - redirect stderr to another stream 19 20 # SYNOPSIS 21 22 ~~~c 23 #include <curl/curl.h> 24 25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STDERR, FILE *stream); 26 ~~~ 27 28 # DESCRIPTION 29 30 Pass a FILE * as parameter. Tell libcurl to use this *stream* instead of 31 stderr when showing the progress meter and displaying CURLOPT_VERBOSE(3) 32 data. 33 34 If you are using libcurl as a Windows DLL, this option causes an exception and 35 a crash in the library since it cannot access a FILE * passed on from the 36 application. A work-around is to instead use CURLOPT_DEBUGFUNCTION(3). 37 38 # DEFAULT 39 40 stderr 41 42 # %PROTOCOLS% 43 44 # EXAMPLE 45 46 ~~~c 47 int 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 64 curl_easy_setopt(3) returns a CURLcode indicating success or error. 65 66 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 67 libcurl-errors(3).