[RESOLVED] FtpGetFile - download, but...
Hello all.
I have problem with FtpGetFile. The code below works - file is downloaded, but...
Original file looks like this (CSV with Tab):
2012-09-21 02:46:20 -0,16 -0,03 -0,08 0,01
2012-09-21 02:46:30 -0,16 -0,03 -0,07 0,01
2012-09-21 02:46:40 -0,16 -0,03 -0,07 0,01
2012-09-21 02:46:50 -0,16 -0,03 -0,07 0,01
After download look like this:
2012-09-21 02:46:20 -0,16 -0,03 -0,08 0,01ഀഀ2012-09-21 02:46:30 -0,16 -0,03 -0,07 0,01ഀഀ2012-09-21 02:46:40 -0,16 -0,03 -0,07 0,01ഀഀ2012-09-21 02:46:50 -0,16 -0,03 -0,07 0,01
The code:
hInternet = InternetOpen("FTPTransfer", INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, INTERNET_FLAG_NO_CACHE_WRITE)
hConnect = InternetConnect(hInternet, sServerName, sFtpPort, sFtpUserName, sFtpPassword, INTERNET_SERVICE_FTP, INTERNET_FLAG_EXISTING_CONNECT Or INTERNET_FLAG_PASSIVE, &H0)
bRet = FtpGetFile(hConnect, FtpFile, LocalFile, False, INTERNET_FLAG_RELOAD, &H1, &H0)
Thanks for the suggestions.
Re: FtpGetFile - download, but...
It looks like you've interchanged the dwFlagsAndAttributes and dwFlags arguments. Refer to the FtpGetFile function for the proper syntax.
Re: FtpGetFile - download, but...
Downloaded data looks OK to me. What's the problem? It's the same data, it's just all in one line of data which includes vbNewLine codes.
Re: FtpGetFile - download, but...
Thank you Bonnie West.
bRet = FtpGetFile(hConnect, FtpFile, LocalFile, False, FILE_ATTRIBUTE_NORMAL, INTERNET_FLAG_RELOAD, &H0)
and work.