您的位置:首页 > 编程语言 > PHP开发

下载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();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: