#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;
}
实现的结果:
成功创建了新的文件夹