curl-users
libcurl, -w option
Date: Thu, 28 Sep 2000 18:16:38 +0200
Hi,
i just downloaded the new curl-7.3 and played around with libcurl.
(I think of building a perl-interface to libcurl, because calling curl as an
external program from my perl-scripts does not really increase performance,
i think... ;-))
In one of my scripts i need to know how many bytes were transfered from the
remote server, i do this by specifying "-w '%{size_download} bytes'" on the
commandline and reading the output from curl in my perl script.
Now i wrote a small test programm and did:
char writeoutbuf[80];
...
strcpy(writeoutbuf, "%{size_download} bytes\\n");
curl_easy_setopt(curl_handle, CURLOPT_WRITEINFO, writeoutbuf);
but the program just prints out "xyz bytes" when calling curl_easy_perform().
So i thought of something like:
int bytes;
...
bytes = curl_easy_getout(curl_handle, CURLOUT_SIZE_DOWNLOAD);
or an option that makes libcurl store the string, that is now printed to
stdout when specifying the -w switch, into a charcter buffer?
This would provide a more complete interface to the users of libcurl, as
after calling curl_easy_perform() they had access to the variables that can
otherwise only be printed with -w
Or how can this be done? Using the lowlevel function curl_read() from libcurl
and counting the bytes by oneself?
Bye,
Georg
Received on 2000-09-28