精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>C/C++>>网络与通讯>>Re:实现FTP传输用什么函数?

主题:Re:实现FTP传输用什么函数?
发信人: hysc(hysc)
整理人: wenbobo(2002-08-05 19:52:37), 站内信件
CInternetSession session;
CFtpConnection *ftp;
ftp=session.GetFtpConnection (m_ip,m_user,m_pass);
CString dir;
ftp->GetCurrentDirectoryAsURL (dir);
ftp->SetCurrentDirectory (m_path);
ftp->GetCurrentDirectory (dir);
CString rptfile;

m_file.MakeReverse();
int len=m_file.Find ('\\');
m_file.MakeReverse ();
rptfile=m_file.Right (len);

char unixpath[1024];
strcpy(unixpath,m_path.GetBuffer (m_path.GetLength ()));

CString ftpfile;
if(unixpath[m_path.GetLength ()-1]=='/')
ftpfile=m_path+rptfile;
else
ftpfile=m_path+'/'+rptfile;


ftp->PutFile(m_file.GetBuffer(m_file.GetLength()),ftpfile,FTP_TRANSFER_TYPE_ASCII);
ftp->Close ();
<p>http://lqhysc.51.net/images/Prt1.gif

[关闭][返回]