1CURLOPT_NETRC_FILE(3)               libcurl              CURLOPT_NETRC_FILE(3)
2
3
4

NAME

6       CURLOPT_NETRC_FILE - file name to read .netrc info from
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC_FILE, char *file);
12

DESCRIPTION

14       Pass  a  char * as parameter, pointing to a null-terminated string con‐
15       taining the full path name to the file  you  want  libcurl  to  use  as
16       .netrc  file.  If  this option is omitted, and CURLOPT_NETRC(3) is set,
17       libcurl will attempt to find a .netrc file in the current  user's  home
18       directory.
19
20       The  application  does not have to keep the string around after setting
21       this option.
22

DEFAULT

24       NULL
25

PROTOCOLS

27       All
28

EXAMPLE

30       CURL *curl = curl_easy_init();
31       if(curl) {
32         CURLcode ret;
33         curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
34         curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
35         curl_easy_setopt(curl, CURLOPT_NETRC_FILE, "/tmp/magic-netrc");
36         ret = curl_easy_perform(curl);
37       }
38

AVAILABILITY

40       Added in 7.10.9
41

RETURN VALUE

43       Returns CURLE_OK if the option is  supported,  CURLE_UNKNOWN_OPTION  if
44       not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
45

SEE ALSO

47       CURLOPT_NETRC(3), CURLOPT_USERNAME(3),
48
49
50
51ibcurl 8.2.1                    April 26, 2023           CURLOPT_NETRC_FILE(3)
Impressum