I am sending the data from a file using the Libcurl post callback. The example here shows, how to send data as 1 byte per call from callback function. I have changed the code so the file is read into chunks. That pretty much works fine.
the current sample code is:
if(sizeleft){
*( char *)ptr = readptr[0];
readptr++;
sizeleft--;
return 1;
}
This example sends the data as 1 byte. but suppose i have to send it multiple bytes.I have tried to increment
readptr by two each time and decreasing sizeleft by twoand ireturn 2bytes at a time.
It didnt work like this and the data is corrupted.
I would appreciate if someone out there could help me out. Thank you