C++ FTP Library? [closed]

2019-01-31 04:00发布

I am looking for an FTP Library for C++ to do basic ftp functions like authenticate, change directory, upload files, etc. but I can't seem to find one. I've searched over Google, Sourceforge, and CodeProject (well, there's one complete FTP CLIENT project for Win95 in CodeProject, however I don't need the entire ftp client..), but I only found C# FTP libraries.

Could you guys please suggest me a good one? or maybe an alternative?

Thanks.

fyi: Microsoft Visual C++ 2008 Express Edition is my only IDE, and I prefer precompiled static library (*.lib) that can be statically linked (if any)

8条回答
劫难
2楼-- · 2019-01-31 04:20

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

查看更多
疯言疯语
3楼-- · 2019-01-31 04:20

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.

查看更多
戒情不戒烟
4楼-- · 2019-01-31 04:26

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

查看更多
男人必须洒脱
5楼-- · 2019-01-31 04:28

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

查看更多
姐就是有狂的资本
6楼-- · 2019-01-31 04:32

Simply use the standard "FtpWebRequest":

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

查看更多
Bombasti
7楼-- · 2019-01-31 04:35

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.

查看更多
登录 后发表回答