Answer the question
In order to leave comments, you need to log in
Data transfer via ftp. How to do?
Hello everyone, in the program you need to transfer a .txt file via ftp to the server. C ++ language, here is something similar in python, but I didn’t find something like this in C ++:
import ftplib
host = "ftp.ex.ru"
ftp_user = "root"
ftp_password = "python"
filename = "picture.png"
con = ftplib.FTP(host, ftp_user, ftp_password)
# Открываем файл для передачи в бинарном режиме
f = open(filename, "rb")
# Передаем файл на сервер
send = con.storbinary("STOR "+ filename, f)
# Закрываем FTP соединение
con.close
Answer the question
In order to leave comments, you need to log in
The most famous thing is cURL. In addition to FTP, it supports FTP+TLS and SFTP.
Here is an example for an FTP upload.
https://curl.haxx.se/libcurl/c/ftpupload.html
In C++ it's better to use "plus" wrappers for cURL, but the code is basically the same.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question