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?


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)

9/27/2012 1:16:47 AM

Accepted Answer

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", 

// connect to server


// 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");


// disconnect

ftpClient.Logout(); 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.

4/30/2015 5:34:10 AM

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow