curl-library
Re: Verbose output
Date: Thu, 4 Apr 2002 23:47:35 +0200 (MET DST)
On Thu, 4 Apr 2002, Wenjie Hua wrote:
> if I set curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE) curlib will print
> out all the commands and responses to the standard out,
No it actually won't, it only prints out a subset of all the info. It also
outputs a range of "informationals" that were not actually neither commands
nor responses (but useful for debugging etc).
> is there any way I can store all the information to a file? what is
> curl_easy_setopt(curl, CURLOPT_FILE, FILE* ) used for?
I advice all newcomers to libcurl programming to read the libcurl-the-guide
document, available on the web here:
http://curl.haxx.se/libcurl/c/the-guide.html
Allow me to quote a bunch of lines from there right now that I think answer
your question:
<quote>
Let's assume for a while that you want to receive data as the URL
indentifies a remote resource you want to get here. Since you write a sort
of application that needs this transfer, I assume that you would like to get
the data passed to you directly instead of simply getting it passed to
stdout. So, you write your own function that matches this prototype:
size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp);
You tell libcurl to pass all data to this function by issuing a function
similar to this:
curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, write_data);
You can control what data your function get in the forth argument by setting
another property:
curl_easy_setopt(easyhandle, CURLOPT_FILE, &internal_struct);
Using that property, you can easily pass local data between your application
and the function that gets invoked by libcurl. libcurl itself won't touch
the data you pass with CURLOPT_FILE.
libcurl offers its own default internal callback that'll take care of the
data if you don't set the callback with CURLOPT_WRITEFUNCTION. It will then
simply output the received data to stdout. You can have the default callback
write the data to a different file handle by passing a 'FILE *' to a file
opened for writing with the CURLOPT_FILE option.
</quote>
I hope this helps!
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/Received on 2002-04-05