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