Mst137 Mst137 - 2 months ago 19
C Question

Using FTP client to send file to FTP server

I would like to create a C program to send a .xml file to a FTP server which I have been given the username and password to periodically. What would be the easiest way to do this?

One idea I had was to just create strings containing the instructions and execute these using

system("command")
however I have not used FTP before so do not know the correct commands to do so. Is there a better way to go about this? Or if this way is valid what commands would i use to send the file via FTP.

Answer
 ftp -u ftp://user:passt@ftp.ftpserver.com/local-file.txt local-file.txt

Probably lftp is a better choice here.

lftp ftp://user:password@host  -e "put local-file.name; bye"