1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_TRANSFERTEXT
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_CRLF (3)
9Protocol:
10  - All
11Added-in: 7.1.1
12---
13
14# NAME
15
16CURLOPT_TRANSFERTEXT - request a text based transfer for FTP
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRANSFERTEXT, long text);
24~~~
25
26# DESCRIPTION
27
28A parameter set to 1 tells the library to use ASCII mode for FTP transfers,
29instead of the default binary transfer. For Win32 systems it does not set the
30stdout to binary mode. This option can be usable when transferring text data
31between systems with different views on certain characters, such as newlines
32or similar.
33
34libcurl does not do a complete ASCII conversion when doing ASCII transfers
35over FTP. This is a known limitation/flaw that nobody has rectified. libcurl
36simply sets the mode to ASCII and performs a standard transfer.
37
38# DEFAULT
39
400, disabled
41
42# %PROTOCOLS%
43
44# EXAMPLE
45
46~~~c
47int main(void)
48{
49  CURL *curl = curl_easy_init();
50  if(curl) {
51    CURLcode res;
52    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/textfile");
53    curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L);
54    res = curl_easy_perform(curl);
55    curl_easy_cleanup(curl);
56  }
57}
58~~~
59
60# %AVAILABILITY%
61
62# RETURN VALUE
63
64Returns CURLE_OK if FTP is supported, and CURLE_UNKNOWN_OPTION if not.
65