Problem with FtpFindFirstFile
Posted
by Xaver
on Stack Overflow
See other posts from Stack Overflow
or by Xaver
Published on 2010-03-18T11:28:06Z
Indexed on
2010/03/18
11:31 UTC
Read the original article
Hit count: 555
I want to download all file from ftp directory i want use for that FtpFindFirstFile and FtpGetFile;
LPWIN32_FIND_DATA FileData;
TCHAR* APP_NAME = TEXT("ftpcli");
TCHAR* PATH_FTP = TEXT("ftp://127.0.01");
TCHAR* ADR_FTP = TEXT("127.0.0.1");
TCHAR* LC_FILE = TEXT("C:\\!");
TCHAR* PATH_FILE = TEXT("/Soft/DVD_Players/WinDVD6");
UINT a;
HINTERNET opn;
HINTERNET conn;
a = InternetAttemptConnect(0);
if (a == ERROR_SUCCESS ) {
if(InternetCheckConnection(PATH_FTP,FLAG_ICC_FORCE_CONNECTION, NULL)) {
opn = InternetOpen(APP_NAME, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
conn = InternetConnect(opn, ADR_FTP, INTERNET_DEFAULT_FTP_PORT, NULL, NULL, INTERNET_SERVICE_FTP, NULL, NULL);
FtpSetCurrentDirectory(conn, PATH_FILE);
FtpFindFirstFile(conn, NULL, &FileData, INTERNET_FLAG_NEED_FILE, NULL);
FtpGetFile(conn, FileData->cFileName, LC_FILE, FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_BINARY, NULL);
}
}
That code return error i know that because i do not identified memory on LPWIN32_FIND_DATA. But i do not know how do it.
© Stack Overflow or respective owner