天天看點

c++ ftplib 連接配接ftp與建立檔案夾

#include "ftplib.h"
void _CreateDir()
 {
     ftplib *ftp = new ftplib();
     int ret = ftp->Connect("127.0.0.1:21");
     if (ret != 1)
     {
         //連接配接失敗
     }
     ret = ftp->Login("test", "123456");
     if (ret != 1)
     {
         //登入失敗
     }    //1、建立檔案夾
     ret = ftp->Mkdir("newDir");
     if (ret != 1)
     {
         //建立檔案夾失敗
     }    //ret = ftp->Get("text.txt", "text.txt", ftplib::image);
     ret = ftp->Quit();
     if (ret != 1)
     {
         //退出失敗
     }    delete ftp;
     ftp = nullptr;
 }      

實作的結果: