GetFile()里面参数设置过很多种 ,如 GetFile("/query.txt","f:\\test\\query.txt"等;
经调试。bOK的值一直是O 。求高人指点指点!代码如下: CFtpConnection* m_pConnection;
CInternetSession* m_pSession;
m_pSession=new CInternetSession(AfxGetAppName(), 1,PRE_CONFIG_INTERNET_ACCESS);
try
{
m_pConnection=m_pSession->GetFtpConnection( "192.168.3.113",
"administrator", "ysh",21,FALSE);
//以上经调试都正常
BOOL bOk = m_pConnection->GetFile("query.txt"),"f:\\test");
if( !bOk)
{
m_pConnection->Close();
delete m_pConnection;
delete m_pSession;
}
}
catch (CInternetException* e)
{
e->Delete();
delete m_pSession;
}
经调试。bOK的值一直是O 。求高人指点指点!代码如下: CFtpConnection* m_pConnection;
CInternetSession* m_pSession;
m_pSession=new CInternetSession(AfxGetAppName(), 1,PRE_CONFIG_INTERNET_ACCESS);
try
{
m_pConnection=m_pSession->GetFtpConnection( "192.168.3.113",
"administrator", "ysh",21,FALSE);
//以上经调试都正常
BOOL bOk = m_pConnection->GetFile("query.txt"),"f:\\test");
if( !bOk)
{
m_pConnection->Close();
delete m_pConnection;
delete m_pSession;
}
}
catch (CInternetException* e)
{
e->Delete();
delete m_pSession;
}
用GetLastError()函数看看返回值是多少
同时分享 解决方法:
m_pConnection->SetCurrentDirectory("/ftp//")
第一个是/ 第二个是//
/表示根目录 因为绝对路径是影藏的。
//是转义的路径
如下载的文件在FTP上 /a//b//C//d.txt
开头一个/ 就OK
请帮我看看吧,谢谢高抬贵手。 CInternetSession *pSession;
pSession=new CInternetSession;
CFtpConnection *pFtpCon;
pFtpCon=pSession->GetFtpConnection("127.0.0.1","","",21);
CString selfile, Dstrore , err;
Dstrore = "C:\New folder";
m_list.GetText(m_list.GetCurSel(),selfile);
if(!selfile.IsEmpty())
if(pFtpCon->GetFile(selfile,"C:\New folder"))//这里吗?
AfxMessageBox(_T("recvied"));
else
AfxMessageBox(_T("not respone"));