How do you block until the request response finished in libcurl? I need to block because CURLOPT_WRITEFUNCTION
asynchronously writes to the C-String; so I need to be sure that I can get the full output from a request before I act on the data.
I fixed this by making the callback function return return nmemb*size;
See here for more info: http://curl.haxx.se/mail/lib-2002-12/0065.html
char *array;
int arraySize = 0;
size_t storeContent(char *ptr, size_t size, size_t nmemb, void *userdata) {
int thisSize = nmemb * size;
arraySize += thisSize;
array = realloc(array, arraySize + thisSize);
strcat(array, ptr);
return nmemb * size;
}