关于FTP的问题,在线等待... 我想实现FTP客户端的以下功能:1/连接FTP服务器2/从FTP服务器上GET指定路径下的指定文件到本机指定的文件夹下,一次get一个文件3/断开FTP服务器连接请各位帮忙看看,有没有代码或是控件什么的,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CFtpConnection可以完成你要的功能。 CInternetSession sess(_T("MyProgram/1.0")); CFtpConnection* pConnect=NULL; try { pConnect=sess.GetFtpConnection("202.98.10.206","c51bbs","c51bbs"); CFtpFileFind finder(pConnect); BOOL bWorking=finder.FindFile(_T("*")); while(bWorking) { bWorking =finder.FindNextFile(); printf("%s\n",(LPCTSTR)finder.GetFileURL()); } } catch(CInternetException* pEx) { TCHAR sz[1024]; pEx->GetErrorMessage(sz,1024); printf("ERROR! %s\n",sz); pEx->Delete(); } 网上有很多ftp客户端的源代码 上面的代码好像不能get文件啊? 在while 里,把print变成 pConnect->GetFile(finder.GetFileName(),finder.GetFileName()); 那finder.GetFileName()应该怎么赋值呢?能不能写整理个完整的代码?谢谢 比如在FTP上的是/zx/test.txt这个文件,本机我要下载到d:\log下面 1.CFtpConnection初始化对象。2.对象.SetCurrentDirectory设置到/zx/目录3.GetFile("test.txt","d:\\log\\")完成上述流程,我相信你能搞定。 线程 excel的com接口查询 组合框调用数据库的问题 DirectX[sdk 中DirectPlay带voice交互的例子播放后声音效果不好,什么原因?如何解决?] 怎么拷贝一个类对象的数组? 关于完成端口的不解之处....还望大虾指教 连接数据库时出现问题,请大家帮我,在线等待。 InstallShield使用问题 急急,这两个题目到底对不对? 如何得知用户多长时间没有按键或移动鼠标???(高分) 请教如何在单文档程序的一个切分窗口中打开Windows的cmd命令窗口?望高手指点。 请问如何得到另一程序中EDIT1控件中的字串?
CFtpConnection* pConnect=NULL; try
{
pConnect=sess.GetFtpConnection("202.98.10.206","c51bbs","c51bbs");
CFtpFileFind finder(pConnect);
BOOL bWorking=finder.FindFile(_T("*"));
while(bWorking)
{
bWorking =finder.FindNextFile();
printf("%s\n",(LPCTSTR)finder.GetFileURL());
}
}
catch(CInternetException* pEx)
{
TCHAR sz[1024];
pEx->GetErrorMessage(sz,1024);
printf("ERROR! %s\n",sz);
pEx->Delete();
}
pConnect->GetFile(finder.GetFileName(),finder.GetFileName());
2.对象.SetCurrentDirectory设置到/zx/目录
3.GetFile("test.txt","d:\\log\\")
完成上述流程,我相信你能搞定。