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