curl-library
a problem getting things back through url connection
Date: Thu, 9 Aug 2001 12:41:29 -0700
Hi,
I'm running the following code:
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t written;
written = fwrite(ptr, size, nmemb, stream);
printf("%s\n",ptr);
return written;
}
void init(){
...
headerfile = fopen("dumpit", "w");
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL,
"http://www.yahoo.com");
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(curl, CURLOPT_MUTE, 1);
curl_easy_setopt(curl, CURLOPT_FILE, headerfile);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
write_data);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
...
}
If I don't include the line "written = fwrite(ptr, size, nmemb,
stream);", the result "printf("%s\n",ptr);" will only output about 1/4
of the whole response. And even if I do the writing, the file "dumpit"
don't have the complete response stream.
Is there any way that I can get the complete response without writing to
any files? Thanks!
Li
_______________________________________________
Curl-library mailing list
http://curl.haxx.se/libcurl/
Received on 2001-08-09