curl-library
Re: Fwd: Unable to copy files to windows shared drive using libCurl and FILE protocol
Date: Fri, 4 Jan 2019 22:45:55 +0530
These are my callback functions.
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void
*stream)
{
curl_off_t nread;
/* in real-world cases, this would probably get this data differently
as this fread() stuff is exactly what the library already would do
by default internally */
size_t retcode = fread(ptr, size, nmemb, (FILE*)stream);
nread = (curl_off_t)retcode;
fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T
" bytes from file\n", nread);
return retcode;
}
size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata)
{
return size * nmemb;
}
On Fri, Jan 4, 2019 at 10:44 PM Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 4 Jan 2019, Krishna Chaithanya B wrote:
>
> Again you replied to just me and not the list.
>
> > These are my callback functions.
> >
> > static size_t read_callback(void *ptr, size_t size, size_t nmemb, void
> > *stream)
> > {
> > curl_off_t nread;
> > /* in real-world cases, this would probably get this data differently
> > as this fread() stuff is exactly what the library already would do
> > by default internally */
> > size_t retcode = fread(ptr, size, nmemb, (FILE*)stream);
> >
> > nread = (curl_off_t)retcode;
> >
> > fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T
> > " bytes from file\n", nread);
> > return retcode;
> > }
> >
> >
> > size_t write_callback(char *ptr, size_t size, size_t nmemb, void
> *userdata)
> > {
> > return size * nmemb;
> > }
> >
> >
> > On Fri, Jan 4, 2019 at 10:40 PM Daniel Stenberg <daniel_at_haxx.se> wrote:
> >
> >> On Fri, 4 Jan 2019, Krishna Chaithanya B via curl-library wrote:
> >>
> >>> I am seeing CURLE_WRITE_ERROR as return code, so I tried to add a
> >>> writeCallback but still there is no use.
> >>
> >> Since you didn't show your write callback I can only guess, and I guess
> >> your
> >> write callback returns the wrong return value.
> >>
> >> --
> >>
> >> / daniel.haxx.se
> >>
> >
> >
> >
>
> --
>
> / daniel.haxx.se
>
-- Regards, Krishna Chaithanya B
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-01-04