curl-library
Re: libcurl with gmail.
Date: Sat, 25 Jan 2014 16:58:02 -0800
On Sat, Jan 25, 2014 at 4:39 PM, Corey Feldman-Haim
<myadonisdna_at_gmail.com>wrote:
> I'm using Qt so I have some code like:
>
> [code]
>
> QString qstr = QString(tr("I want to output %1").arg(whatIWantToOutput));
>
>
> [/code]
>
>
> Basically what I need is to set payload_text to contain qstr, this would be easy if payload_text was const char * but it's a a const char * array and I'm a little confused on how to go from a string to a const char pointer array.
>
>
The idea of CURLOPT_READFUNCTION is that you can implement your own
function that reads from whatever payload source you are using. The read
function in the example is for the (artificial) use case of your data
source being a char*[]. Since your payload comes as QString, it will be
easier to write your own version of the payload_source function that can
read from a QString as opposed to trying to fit your QString into a
char*[]. See
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTREADFUNCTION
for details on how your QString read function should behave.
Regards,
Fabian
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-26