curl-library
RE: CURL and CULM data structure
Date: Fri, 28 Oct 2016 15:31:18 +0000
Hi,
Got it. For de-referencing only I am asking the data structure for CURL.
So that I can take a took what are the possible values, and which value is causing the crash.
CURLM *multi_handle;
multi_handle->?->?
Regards,
Agalya
From: curl-library [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of bch
Sent: Friday, October 28, 2016 11:00 AM
To: libcurl development <curl-library_at_cool.haxx.se>
Subject: RE: CURL and CULM data structure
On Oct 28, 2016 7:38 AM, "Ramachandran, Agalya (Contractor)" <Agalya_Ramachandran_at_comcast.com<mailto:Agalya_Ramachandran_at_comcast.com>> wrote:
>
> Hi,
>
> Am using "%p", to print the handle pointer, and I could able to see the pointer value in handle.
> But am trying to print the actual value in handle. (i.e data in the pointer)
> How this can be achieved?
You need to dereference the pointer(s) to whatever final value you want. Eg: if you have a Curl_easy *p pointer properly initialized:
if(p->cookies) {
printf(" cookie filename: %s\n", p->cookies->filename);
}
Will print out the string rep of (presumably) the file holding cookies for this easy session. Note that we test that "cookies" is set at all before we try to deference ("if(p->cookies)"), because of you try to deference a NULL pointer (or indeed any "garbage" value), you will have problems.
You can find out what you need by reading up on pointers, memory allocation (malloc() and free()), structures, and pointer arithmetic.
Note to - my example was of the top of my head, and curl has a tremendous amount of introspective accessor functions purpose-built to retrieve information; your use case my already be expertly solved in the project.
-bch
> Regards,
> Agalya
> -----Original Message-----
> From: curl-library [mailto:curl-library-bounces_at_cool.haxx.se<mailto:curl-library-bounces_at_cool.haxx.se>] On Behalf Of Rich Gray
> Sent: Friday, October 28, 2016 9:55 AM
> To: libcurl development <curl-library_at_cool.haxx.se<mailto:curl-library_at_cool.haxx.se>>
> Subject: Re: CURL and CULM data structure
>
> Ramachandran, Agalya (Contractor) wrote:
> > Hi team,
> >
> > I have a query with respect to CURL and CURLM data structure.
> >
> > For debugging purpose, I want to print the actual value in the
> > following handles.
> >
> > ·CURL *handle;
> >
> > ·CURLM *multi_handle;
> >
> > Can you please guide me what is the data structure for CURL, and how
> > can I print it in ‘C’ language?
> >
> > Regards,
> >
> > Agalya
>
> Use %p to format pointers. It formats addresses as hex.
>
> printf("curl handle %p", handle);
>
> - Rich
> -------------------------------------------------------------------
> List admin: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>
> -------------------------------------------------------------------
> List admin: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-10-28