cURL / Mailing Lists / curl-library / Single Mail

curl-library

fopen() download file

From: Denis Bondarev <asterganster_at_gmail.com>
Date: Fri, 14 Aug 2009 14:59:21 +0300

Hello all. Please help me with download file (binary file *.rar) use
libcurl!!! I write next code in writerfunction

///////////////////////////
static size_t WriterFile(char *data, size_t size, size_t nmemb, AnsiString
*buffer)
{
size_t result = 0;
FILE *src;

 src=fopen("blablabla.rar", "a");

if(buffer != NULL)
{

fwrite(data, sizeof(char) , nmemb, src);

result = size * nmemb;

}

fclose(src);
delete src;
delete &nmemb;

return result;
delete &result;
  } ;
///////////////////////////
but i receive incorrect file :( If i use normal download over browser - I
receive correct file. Please help me with this. I em use Builder C++

P.S.

Very interesting error I receive wen use my next function:
///////////////////////////
static size_t Writer(char *data, size_t size, size_t nmemb, WideString
*buffer)
{
size_t result = 0;

if(buffer != NULL)
{

buffer->Insert(data,buffer->Length()+1);

result = size * nmemb;

}

delete &nmemb;

return result;
delete &result;
delete buffer;
} ;
/////////////////
it is my function for download http. If I download page from google on UTF8
encode, this function no give me full correct text, end function UTF8Decod()
give me error...
Received on 2009-08-14