|
-
Apr 30th, 2013, 01:57 PM
#1
Thread Starter
Member
[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.
-
Apr 30th, 2013, 02:29 PM
#2
Re: FtpGetFile - download, but...
It looks like you've interchanged the dwFlagsAndAttributes and dwFlags arguments. Refer to the FtpGetFile function for the proper syntax.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Apr 30th, 2013, 04:26 PM
#3
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.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
-
May 1st, 2013, 04:06 AM
#4
Thread Starter
Member
Re: FtpGetFile - download, but...
Thank you Bonnie West.
bRet = FtpGetFile(hConnect, FtpFile, LocalFile, False, FILE_ATTRIBUTE_NORMAL, INTERNET_FLAG_RELOAD, &H0)
and work.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|