I am trying to set a rotating background image by downloading an image from a server (website) and attempted to do this with curl however have had 0 success at doing this. A (shortened) version of my code is below. I am not getting errors, however, how would I save this image "temporarily" to display it as my background? Is there an image (-type variable) or something?
This is just a learning experience so any libraries or suggestions would be much appreciated.
#include <curl/curl.h>
CURL *curlCtx = curl_easy_init();
curl_easy_setopt(curlCtx, CURLOPT_URL, "http://www.examplesite.com/testimage.jpeg");
curl_easy_setopt(curlCtx, CURLOPT_WRITEDATA, this);
curl_easy_setopt(curlCtx, CURLOPT_WRITEFUNCTION, callbackfunction);
const CURLcode rc = curl_easy_perform(curlCtx);
if(rc == CURLE_OK){
//it worked
}
size_t callbackfunction(char *data, size_t size, size_t nmemb, void *stream){
//do something here with image...?
}
Thanks, James
Edit: Sorry I added () to callbackfunction by mistake.