xref: /curl/docs/libcurl/curl_easy_strerror.md (revision 5a488251)
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
14Added-in: 7.12.0
15---
16
17# NAME
18
19curl_easy_strerror - return string describing error code
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26const char *curl_easy_strerror(CURLcode errornum);
27~~~
28
29# DESCRIPTION
30
31The curl_easy_strerror(3) function returns a string describing the
32CURLcode error code passed in the argument *errornum*.
33
34Typically applications also appreciate CURLOPT_ERRORBUFFER(3) for more
35specific error descriptions generated at runtime.
36
37# %PROTOCOLS%
38
39# EXAMPLE
40
41~~~c
42int 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
62A pointer to a null-terminated string.
63