curl-library
Re: Writing verbose infos to file fails on win32 !
Date: Fri, 28 May 2004 06:50:12 +0300
Hi!
The following piece of code worked for me. Have a look at it.
-----------------------------------------
int debug_callback (CURL * hadle, curl_infotype type, char * szMsg, size_t
nLen, void *)
{
switch (type)
{
case CURLINFO_TEXT:
{
FILE *file = NULL;
if ((file = fopen("curldbg.txt", "a")) == NULL) {
printf("curldbg.txt could not be open");
} else {
fwrite(szMsg, nLen, 1, file);
fclose( file );
}
}
break;
}
return 0;
}
...
CURL *handle = curl_easy_init();
if (0 != handle) {
curl_easy_setopt(handle, CURLOPT_DEBUGFUNCTION, debug_callback);
curl_easy_setopt(handle, CURLOPT_VERBOSE, TRUE);
...
}
...
-------------------------------------------
Citat Stefan Libcurl <libcurl_at_hotmail.com>:
> Hi !
>
> I want to write verbose infos to a file.
>
> Here my code:
> ...
> FILE* info;
>
> res = curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE);
>
> if ( (info = fopen("info.txt", "w+")) == NULL )
> printf("info.txt couldn't not open !");
> else
> res = curl_easy_setopt(curl, CURLOPT_STDERR, info);
> ...
>
> fopen() works, ... the file is created and exists.
>
> After curl_easy_perform(curl) my program crahes.
>
> What's going wrong ?
>
> Thanks ...
>
> _________________________________________________________________
> MSN Messenger - sehen, welche Freunde online sind!
> http://www.msn.de/messenger Jetzt kostenlos downloaden und mitmachen!
>
>
Received on 2004-05-28