curl_easy_strerror.md (1164B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: curl_easy_strerror 5 Section: 3 6 Source: libcurl 7 See-also: 8 - curl_multi_strerror (3) 9 - curl_share_strerror (3) 10 - curl_url_strerror (3) 11 - libcurl-errors (3) 12 Protocol: 13 - All 14 Added-in: 7.12.0 15 --- 16 17 # NAME 18 19 curl_easy_strerror - return string describing error code 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 const char *curl_easy_strerror(CURLcode errornum); 27 ~~~ 28 29 # DESCRIPTION 30 31 The curl_easy_strerror(3) function returns a string describing the 32 CURLcode error code passed in the argument *errornum*. 33 34 Typically applications also appreciate CURLOPT_ERRORBUFFER(3) for more 35 specific error descriptions generated at runtime. 36 37 # %PROTOCOLS% 38 39 # EXAMPLE 40 41 ~~~c 42 int main(void) 43 { 44 CURL *curl = curl_easy_init(); 45 if(curl) { 46 CURLcode res; 47 /* set options */ 48 /* Perform the entire transfer */ 49 res = curl_easy_perform(curl); 50 /* Check for errors */ 51 if(res != CURLE_OK) 52 fprintf(stderr, "curl_easy_perform() failed: %s\n", 53 curl_easy_strerror(res)); 54 } 55 } 56 ~~~ 57 58 # %AVAILABILITY% 59 60 # RETURN VALUE 61 62 A pointer to a null-terminated string.