void downloadFile()
{
sf::IpAddress address = "127.0.0.1";
sf::Ftp server;
sf::Ftp::Response connectResponse = server.connect(address);
if (!connectResponse.isOk())
{
//连接失败
}
// Ask for user name and password
std::string user = "test", password = "1234";
// Login to the server
sf::Ftp::Response loginResponse = server.login(user, password);
if (!loginResponse.isOk())
{
//登录失败
}
//获取当前工作的文件夹
sf::Ftp::DirectoryResponse workdir = server.getWorkingDirectory();
//参数1指的是远程文件需要切换到指定的目录;参数2指的是本地文件夹,这里不要放在c盘,具体原因位置
sf::Ftp::Response response = server.download("1.mdb", "E:\\framework\\1");
if (!response.isOk())
{
//下载失败
int yy = 55;
}
response = server.getWorkingDirectory();
server.disconnect();
}