How can I download a file using libcurl and rather than save it to disk, just read its file contents? I see that I can use the WRITEFUNCTION to write the file to disk, but I do not see how I can just pull from the server and read without saving to disk first.
Share
You can use WRITEFUNCTION to write anywhere you want, even keeping things in memory only without writing to disk. Look at the example in the
libcurlwebsite:http://curl.haxx.se/libcurl/c/getinmemory.html
The example is C-ish, but you can easily replace the allocations with a
vector<byte>or astring