[RESOLVED] FtpGetFile - download, but...-VBForums
Results 1 to 4 of 4

Thread: [RESOLVED] FtpGetFile - download, but...

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    32

    Resolved [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.

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,057

    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)

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,072

    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.

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2006
    Posts
    32

    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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.