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