Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HTML Downloads since Foxpro
Message
De
16/11/1999 09:51:54
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00291424
Message ID:
00291452
Vues:
19
>Im Trying to develop an aplication with the Internet Transfer Protocol, I need to use HTML as protocol, not FPT as is common, i have found this example in Inet help file, but this procedures are implemented in Visual Basic.
>
>My trouble consist to find the way to declare a variable as Byte, if I change those procedures to work with text, it works but if i download a .dbf file it return to me an array and i don't find the way to save this array to my computer.
>
>I try with FOPEN(), FCLOSE() functions but it didn't work.
>
>
>Private Sub Form_DblClick()
> Inet1.AccessType = icUseDefault
> Dim b() As Byte
> Dim strURL As String
>
> ' Presuming this is still a valid URL.
> strURL = "http://ftp.microsoft.com/" & _
> "developr/drg/Win32/Autorun.zip"
>
> ' Retrieve the file as a byte array.
> b() = Inet1.OpenURL(strURL, icByteArray)
>
> Open "C:\Temp\Autorun.zip" For Binary Access _
> Write As #1
> Put #1, , b()
> Close #1
> MsgBox "Done"
>End Sub
>
>Thanks and Regards.

Couple of things:

First, your URL does not work. So, assuming a working URL, you can gte a binary file as a byte array like this:


strURL = "http://SomeDomain.com/somebinaryfile.dbf"

* Retrieve the file as a byte array.

laFileArray = THISFORM.Inet.OpenURL(strURL, 1)

lcFileString = ""
FOR i = 1 TO ALEN(laFileArray)
lcFileString = lcFileString + CHR(laFileArray[i])
ENDFOR

STRTOFILE(lcFileString, "c:\SomeBinaryFile.dbf")


The variable that the function returns when you pass in 1 as the second parameter is actually a VFP array. Its values are numeric, and all oyuhave to do is translate them into their characters with CHR().
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform