mfc 的哪个函数会获得ftp 中当前文件夹中的文件列表
mfc 的哪个函数能获得ftp 中当前文件夹中的文件列表
m_pFtpConnection->GetCurrentDirectory(strDirName); 这个函数只能获取当前文件夹的名字
以为我要下载指定文件夹中的所有文件 所以我想先获取文件夹中所有文件的名字 然后依次下载
高手指教
------解决方案--------------------
http://msdn.microsoft.com/en-US/library/272ce2aa(v=vs.80)
------解决方案--------------------
GetLastError查看出错原因呢。。
------解决方案--------------------
MSDN上的示例.
m_pFtpConnection->GetCurrentDirectory(strDirName); 这个函数只能获取当前文件夹的名字
以为我要下载指定文件夹中的所有文件 所以我想先获取文件夹中所有文件的名字 然后依次下载
高手指教
------解决方案--------------------
http://msdn.microsoft.com/en-US/library/272ce2aa(v=vs.80)
------解决方案--------------------
GetLastError查看出错原因呢。。
------解决方案--------------------
MSDN上的示例.
- C/C++ code
// create a session object to initialize WININET library // Default parameters mean the access method in the registry // (that is, set by the "Internet" icon in the Control Panel) // will be used. CInternetSession sess(_T("My FTP Session")); CFtpConnection* pConnect = NULL; try { // Request a connection to ftp.microsoft.com. Default // parameters mean that we'll try with username = ANONYMOUS // and password set to the machine name @ domain name pConnect = sess.GetFtpConnection(_T("ftp.microsoft.com")); // use a file find object to enumerate files CFtpFileFind finder(pConnect); // start looping BOOL bWorking = finder.FindFile(_T("*")); while (bWorking) { bWorking = finder.FindNextFile(); _tprintf_s(_T("%s\n"), (LPCTSTR)finder.GetFileURL()); } } catch (CInternetException* pEx) { TCHAR sz[1024]; pEx->GetErrorMessage(sz, 1024); _tprintf_s(_T("ERROR! %s\n"), sz); pEx->Delete(); } // if the connection is open, close it if (pConnect != NULL) { pConnect->Close(); delete pConnect; }