curl-library
Re: File type to download
Date: Tue, 23 Jun 2009 14:17:01 +1000
Hi all
Jeff, as this is not a Forum designed to look at FreeBasic code, I
thought it
inappropriate to post the whole code. Certainly would not ignore anybody
trying to help.Half the time I get comments ""use a real programming
language"
Apologies.
In case my url was the problem, I used the one you used.
--------------------------------------------------------------------------
#Include Once "curl.bi"
Dim Ver_Ptr As ZString Ptr
Dim as CURL ptr ftp_Handle
Dim Shared As Integer FP
private function write_callback cdecl ( byval buffer as byte ptr,byval
size as integer,byval nitems as integer,byval outstream as any Ptr) as
Integer
Dim as integer bytes = size * nitems
put #FP ,,*buffer,bytes
function = bytes 'this is used by curl to verify
delivered = written
end Function
Cls
Ver_Ptr = curl_version() 'Get pointer to Version info.
Print "Version=";
Locate 1,1:Print *Ver_Ptr 'print the info
ftp_handle = curl_easy_init() 'Initialize and get Handle
FP = FreeFile
Open "testfile.bin"For Binary Access Write As #FP
'-------------------------------
curl_easy_setopt( ftp_handle, CURLOPT_VERBOSE,1)
curl_easy_setopt( ftp_handle, CURLOPT_URL,
"http://softlayer.dl.sourceforge.net/sourceforge/fbc/FB-manual-0.20.0-chm.zip")
curl_easy_setopt( ftp_handle, CURLOPT_WRITEFUNCTION, @write_callback )
curl_easy_perform(ftp_handle)
curl_easy_cleanup(ftp_handle) 'cleanup and quit cURL
'-------------------------------
Close #FP
End
---------------------------------------------------------------------
Lots of inactivity, and finally after 8 min the same error.
Failure when receiving data from the peer.
I guess you dont use Watt & or djgpp in Linux.
Regards
Received on 2009-06-23