C++ FTP Library? [closed]

南笙酒味 提交于 2019-11-29 20:28:48
drowneath

Just to inform those who are looking for a good C++ FTP Library/Class, I've found a very good and easy to use one. Using it is just as easy as using C# FTP library that has been made by many peoples already. If you haven't tried one, here's an example code:

nsFTP::CFTPClient ftpClient;
nsFTP::CLogonInfo logonInfo("localhost", 21, "anonymous", 
                                      "anonymous@user.com");

// connect to server

ftpClient.Login(logonInfo);

// get directory listing

nsFTP::TSpFTPFileStatusVector list;
ftpClient.List("/", list);

// iterate listing

for( nsFTP::TSpFTPFileStatusVector::iterator it=list.begin(); 
                                         it!=list.end(); ++it )
    TRACE("\n%s", (*it)->Name().c_str());

// do file operations

ftpClient.DownloadFile("/pub/test.txt", "c:\\temp\\test.txt");

ftpClient.UploadFile("c:\\temp\\test.txt", "/upload/test.txt");

ftpClient.RenameFile("/upload/test.txt", "/upload/NewName.txt");

ftpClient.Delete("/upload/NewName.txt");

// disconnect

ftpClient.Logout();

http://www.codeproject.com/Articles/8667/FTP-Client-Class and enjoy!

And it is totally programmed in C++ with STL (no MFC)

I am sorry for switching the answer to this post, because I think this is a better solution, rather than using the ones that written in C.

libftp (though it's in C)
ftplib (again, looks like C)
libCurl seems to have FTP capabilities.

Finding a C++ implementation might be difficult, but wrapping a C library in C++ classes wouldn't be difficult if you really need a C++ interface.

Edit: Just saw that you prefer a pre-compiled library. If this is an absolute requirement you'll probably have to use a C library as ABI issues will more than likely mean that a pre-compiled C++ library won't work for you.

Try libCurl. It has bindings for C++ (cURLpp) and 30 other languages.

Take a look at Poco Project released under Boost software license.

They provide an FTP RFC 959 implementation. You can do login or updload files, change modes etc. as the functionality of FTPSession class.

Regards,
Ovanes

P.S. It is a multi-platform lib, which works on Windows as well.

QT has a QFtp class which might contain all you need.

i think wininet.h should be sufficient for visual studio 2008

Try Ultimate TCP/IP which supports FTP (and you can just compile in the FTP part). It's a great library (and it's free).

http://www.codeproject.com/KB/MFC/UltimateTCPIP.aspx

Simply use the standard "FtpWebRequest":

http://msdn.microsoft.com/en-us/library/ms229711.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!