C++ and FTP

Per Anton R?nning pa-ronn at online.no
Wed Oct 29 13:04:11 UTC 2008


iztok at sport-slo.net wrote:
> Hello,
>
> I have to use FTP connection in C++ applications.
>
> I found some tutorials, but nothing interesting.
>
> Has anybody been doing with FTP functions?
>
> I will need some tutorials about it.
>
> Thank you.
>
Hi,
I would also recommend curl, I use it a lot.

form man curl:
curl  is  a  tool to transfer data from or to a server, using one of the 
supported protocols
       (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET,  LDAP  
or  FILE).   The  command  is
       designed to work without user interaction.


Example:
-------------
char  curlcmd[100];
char url[]="http://<url....>",char receiving_file[]="/<some 
directory>/recfile.html"
//setup url command
  sprintf(curlcmd,"curl %s > %s",url,receiving_file);
  i=system(curlcmd);

I don't use it for FTP purposes, but for HTTP sites, and the result is 
put nicly into the receiving file specified in the
curlcmd. I then run it through a program removing all tags,  and then I 
can process the data.

Try it  out with FTP instead of HTTP, it should work like a charm.
 
BRGDS
PAR





More information about the fedora-list mailing list