https://curl.haxx.se/libcurl/c/curl_easy_setopt.htmlCURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter);
curl_easy_setopt is used to tell libcurl how to behave. By setting the appropriate options, the application can change libcurl's behavior. All options are set with an option followed by a parameter. That parameter can be a long, a function pointer, an object pointer or a curl_off_t, depending on what the specific option expects
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData.c_str());
На с++ используя либу curl.
есть
C++ libcurl bindings
исходники
curl_easy_setopt обертка над
static CURLcode vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
в которой ваша std::string postData превращается в тыкву
case CURLOPT_POSTFIELDS:
/*
* Like above, but use static data instead of copying it.
*/
data->set.postfields = va_arg(param, void *); // Тут <-----------------------<<<<
/* Release old copied data. */
(void) Curl_setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);
data->set.httpreq = HTTPREQ_POST;
break;