2016. 10. 24. 18:14 MFC/FTP
MFC) FTP 필수 클래스 - CFtpFileFind
반응형
[MSDN 퍼옴]
CFtpFileFind Class
Visual Studio 2015
인터넷 파일 검색의 FTP 서버 지원입니다.
class CFtpFileFind : public CFileFind
Public 생성자
Name | 설명 |
---|---|
CFtpFileFind::CFtpFileFind | CFtpFileFind 개체를 생성합니다. |
Public 메서드
Name | 설명 |
---|---|
CFtpFileFind::FindFile | FTP 서버에 있는 파일을 찾습니다. |
CFtpFileFind::FindNextFile | 파일 검색에 대 한 이전 호출에서 계속 FindFile. |
CFtpFileFind::GetFileURL | 찾은 파일의 경로 포함 하는 URL을 가져옵니다. |
CFtpFileFind
검색을 시작 하 고 파일을 찾은 URL 또는 다른 파일에 대 한 설명 정보를 반환 하는 멤버 함수가 포함 되어 있습니다.
인터넷 및 로컬 파일 검색 등 설계 다른 MFC 클래스 CGopherFileFind 및 CFileFind. 과 함께 CFtpFileFind
, 이러한 클래스는 특정 파일 서버에 관계 없이 프로토콜 또는 파일 형식 (로컬 컴퓨터 또는 원격 서버)에 클라이언트에 대 한 원활한 메커니즘이 있습니다. 참고 MFC 클래스가 없습니다. 검색에 필요한 파일을 직접 조작 HTTP를 지원 하지 않기 때문에 HTTP 서버에서 검색 됩니다.
사용 하는 방법에 대 한 자세한 내용은 CFtpFileFind
및 기타 WinInet 클래스 문서를 참고 하십시오. WinInet 인터넷 프로그래밍.
다음 코드는 FTP 서버의 현재 디렉토리의 모든 파일을 열거 하는 방법을 보여 줍니다.
// 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; }
CFtpFileFind
헤더: afxinet.h
반응형
'MFC > FTP' 카테고리의 다른 글
FTP) FTP란? (0) | 2016.12.19 |
---|---|
MFC) FTP 간단 예제 소스 (0) | 2016.10.25 |
MFC) FTP 필수 클래스 - CFtpConnection (0) | 2016.10.24 |
MFC) FTP 필수 클래스 - CInternetSession (0) | 2016.10.24 |