|
-
Oct 18th, 2001, 08:47 AM
#1
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
-
Oct 18th, 2001, 01:06 PM
#2
PowerPoster
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.
-
Oct 18th, 2001, 01:26 PM
#3
Have you ever used the ASCII or BINARY ftp commands?
-
Oct 19th, 2001, 10:46 AM
#4
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|