CURLOPT_TRANSFERTEXT.md (1495B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_TRANSFERTEXT 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_CRLF (3) 9 Protocol: 10 - All 11 Added-in: 7.1.1 12 --- 13 14 # NAME 15 16 CURLOPT_TRANSFERTEXT - request a text based transfer for FTP 17 18 # SYNOPSIS 19 20 ~~~c 21 #include <curl/curl.h> 22 23 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRANSFERTEXT, long text); 24 ~~~ 25 26 # DESCRIPTION 27 28 A parameter set to 1 tells the library to use ASCII mode for FTP transfers, 29 instead of the default binary transfer. For Win32 systems it does not set the 30 stdout to binary mode. This option can be usable when transferring text data 31 between systems with different views on certain characters, such as newlines 32 or similar. 33 34 libcurl does not do a complete ASCII conversion when doing ASCII transfers 35 over FTP. This is a known limitation/flaw that nobody has rectified. libcurl 36 simply sets the mode to ASCII and performs a standard transfer. 37 38 # DEFAULT 39 40 0, disabled 41 42 # %PROTOCOLS% 43 44 # EXAMPLE 45 46 ~~~c 47 int 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 64 curl_easy_setopt(3) returns a CURLcode indicating success or error. 65 66 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 67 libcurl-errors(3).