Results 1 to 4 of 4

Thread: Inet Control - ASCII vs. Binary

  1. #1
    ImpShial
    Guest

    Angry Inet Control - ASCII vs. Binary

    I am developing an application to download text-format data files from a server where I work and I'm having problems forcing the Inet control to download the file in ASCII mode rather than Binary mode.

    I'm using the Execute and GET statements, but how do I force ASCII mode? There has to be a way!

    Help!

    Imp

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Is it possible to use OpenUrl method in your case. Then its quite easy. I have never tried the Execute method, so I am not sure.

  3. #3
    ImpShial
    Guest
    Have you ever used the ASCII or BINARY ftp commands?

  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    This is what i use to download ASCII and Binary files:
    From MSDN:

    Saving to a File Using the OpenURL Method
    If you wish to save the data retrieved through the OpenURL method to a file, use the Open, Put, and Close statements, as shown in the code below.
    Code:
    'This example streams a binary file into a Byte array before saving 
    'the data to disk:
    
    Dim strURL As String
    Dim bData() As Byte      ' Data variable
    Dim intFile As Integer   ' FreeFile variable
    strURL = _
    "ftp://ftp.microsoft.com/Softlib/Softlib.exe"
    intFile = FreeFile()      ' Set intFile to an unused
                            ' file.
    ' The result of the OpenURL method goes into the Byte 
    ' array, and the Byte array is then saved to disk.
    bData() = Inet1.OpenURL(strURL, icByteArray)
    Open "C:\Temp\Softlib.exe" For Binary Access Write _ 
    As #intFile
    Put #intFile, , bData()
    Close #intFile
    
    
    'A similar procedure can be used to write a text file to disk, except 
    'no Byte array is needed; the data is saved directly to the file:
    
    Dim strURL As String      ' URL string
    Dim intFile As Integer   ' FreeFile variable
    IntFile = FreeFile()
    strURL = "http://www.microsoft.com"
    Open "c:\temp\MSsource.txt" For Output _
    As #IntFile
    Write #IntFile, Inet1.OpenURL(strURL)
    Close #IntFile

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width