下载FTP服务器上文件
2009-12-07 09:47
309 查看
#include "afxinet.h"
CInternetSession* m_pInetSession;
CFtpConnection* m_pFtpConnection;
m_pInetSession = new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
try
{
CString addr,uid,pass;
GetDlgItemText(IDC_EDIT11,addr);
GetDlgItemText(IDC_EDIT5,uid);
GetDlgItemText(IDC_EDIT4,pass);
m_pFtpConnection = m_pInetSession->GetFtpConnection(addr,uid,pass,21);
m_pFtpConnection->Command("CWD /download/excel服务器安装程序/V8.6/091123");
}
catch(CInternetException *pEx)
{
TCHAR szError[1024];
if(pEx->GetErrorMessage(szError,1024))
AfxMessageBox(szError);
else
AfxMessageBox("There was an exception");
pEx->Delete();
m_pFtpConnection=NULL;
}
m_pFtpConnection->GetFile("ExcelServer2008EE_client.exe","d://ExcelServer2008EE_client.exe",TRUE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_BINARY,1);
AfxMessageBox("download sucessfull");
m_pInetSession->Close();
CInternetSession* m_pInetSession;
CFtpConnection* m_pFtpConnection;
m_pInetSession = new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
try
{
CString addr,uid,pass;
GetDlgItemText(IDC_EDIT11,addr);
GetDlgItemText(IDC_EDIT5,uid);
GetDlgItemText(IDC_EDIT4,pass);
m_pFtpConnection = m_pInetSession->GetFtpConnection(addr,uid,pass,21);
m_pFtpConnection->Command("CWD /download/excel服务器安装程序/V8.6/091123");
}
catch(CInternetException *pEx)
{
TCHAR szError[1024];
if(pEx->GetErrorMessage(szError,1024))
AfxMessageBox(szError);
else
AfxMessageBox("There was an exception");
pEx->Delete();
m_pFtpConnection=NULL;
}
m_pFtpConnection->GetFile("ExcelServer2008EE_client.exe","d://ExcelServer2008EE_client.exe",TRUE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_BINARY,1);
AfxMessageBox("download sucessfull");
m_pInetSession->Close();
相关文章推荐
- 实现FTP服务器文件下载
- 【FTP】批处理下载FTP服务器上指定分钟数之前的文件
- linux批量下载FTP服务器文件
- 定时下载FTP服务器上面的文件到本地
- FTP服务器文件的批量下载
- [置顶] 利用cmd连接ftp服务器上传下载文件
- 使用WebClient从FTP服务器下载文件…
- Linux 系统下 ftp 服务器的搭建,及文件配置,上传下载等
- Java FTP 实现跨服务器文件上传下载
- libcurl 下载ftp服务器全部文件
- java从ftp服务器上传下载文件
- libcurl 下载ftp服务器全部文件
- 嵌入式 在arm平台运行ftpd服务器实现文件下载以及上传以及ftp下载url小结
- Android和FTP服务器交互,上传下载文件(实例demo)
- 新建ftp站点,使用代码从ftp服务器下载文件(mfc)
- Windows下配置ftp服务器,使用QT实现文件上传和下载
- python通过FTP方式从虚拟机服务器上下载文件
- JAVA实现FTP服务器文件的上传,下载,删除功能
- window服务器通过sftp从linux下载文件,并ftp上传到window服务器
- 以命令方式从FTP 服务器下载文件到本地指定目录