关于FTP上传下载文件 MFT是什么?应该是那个编译环境无法识别FtpPutFile、InternetOpen等函数,是不是少了一些lib文件,比如winsock2.lib等等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 应该不是无法识别函数,就是运行compile没有问题,再运行build问题就出来了 #pragma comment(lib,"Wininet.lib") 也可以把lib文件加到项目属性中,链接里面的输入项 是没有引入库引起的,引起链接不通过,不知道用哪个库简单,拷贝函数名到msdn上查一下,看一下函数的Requirements部分说明便知: 加入库#pragma comment(lib,"Wininet.lib") 下载FTP文件示例//将FTP根目录的文件显示在列表中CInternetSession* pSession; pSession = new CInternetSession; //构造新的连接 CFtpConnection* pFtpCon; pFtpCon = pSession->GetFtpConnection("192.168.1.23",NULL,NULL,22);//连接FTP服务器 CFtpFileFind ftpfind(pFtpCon); if (ftpfind.FindFile(NULL)) //查找所有的文件 { CString str ; while ( ftpfind.FindNextFile()) { if (!ftpfind.IsDirectory()) //判断是否是目录 { str = ftpfind.GetFileName(); m_list.AddString(str); } } if (!ftpfind.IsDirectory()) { str = ftpfind.GetFileName(); m_list.AddString(str); } }//codego.net/tags/7/1/ delete pSession;//下载FTP服务器上的指定文件void CFtpDownloadDlg::OnOK() { CInternetSession* pSession; pSession = new CInternetSession; CFtpConnection* pFtpCon; pFtpCon = pSession->GetFtpConnection("192.168.1.23",NULL,NULL,22); CString selfile; m_list.GetText( m_list.GetCurSel(),selfile); if (!selfile.IsEmpty()) { pFtpCon->GetFile(selfile,"c:\\"+selfile);//下载文件到C盘 }} 数独的MFC界面文本编辑问题 知道数字签名/加密邮件的DX进来,请教一下。 请教用过CF(CompactFlash)卡的??? 求 ATL开发指南第二版 电子版,谢谢, MFC中不能自动添加事件 桌面切换的问题 求助:PVOID类型参数和缓冲区的问题 编用回溯法解决跳棋销子的程序http://home.jlu.edu.cn/~z/Algorithms/JumpChess_1.rar 关于加载cursor 请问如何在32位环境下调用16的DLL? win7 vs2010编译的画图程序,mfc写的,在xp下面能打开程序,但是画的图没有显示, tcp 发送端 out-of-order
应该不是无法识别函数,就是运行compile没有问题,再运行build问题就出来了
Requirements部分说明便知:
#pragma comment(lib,"Wininet.lib")
//将FTP根目录的文件显示在列表中
CInternetSession* pSession;
pSession = new CInternetSession; //构造新的连接
CFtpConnection* pFtpCon;
pFtpCon = pSession->GetFtpConnection("192.168.1.23",NULL,NULL,22);//连接FTP服务器 CFtpFileFind ftpfind(pFtpCon);
if (ftpfind.FindFile(NULL)) //查找所有的文件
{
CString str ;
while ( ftpfind.FindNextFile())
{
if (!ftpfind.IsDirectory()) //判断是否是目录
{
str = ftpfind.GetFileName();
m_list.AddString(str);
}
}
if (!ftpfind.IsDirectory())
{
str = ftpfind.GetFileName();
m_list.AddString(str);
}
}//codego.net/tags/7/1/
delete pSession;
//下载FTP服务器上的指定文件
void CFtpDownloadDlg::OnOK()
{
CInternetSession* pSession;
pSession = new CInternetSession;
CFtpConnection* pFtpCon;
pFtpCon = pSession->GetFtpConnection("192.168.1.23",NULL,NULL,22); CString selfile;
m_list.GetText( m_list.GetCurSel(),selfile);
if (!selfile.IsEmpty())
{
pFtpCon->GetFile(selfile,"c:\\"+selfile);//下载文件到C盘
}}