curl-library
write_data help needed
From: ChristinaPSU <mail_at_drsdatarecovery.com>
Date: Tue, 27 Jan 2009 07:49:21 -0500
Date: Tue, 27 Jan 2009 07:49:21 -0500
Hello all,
So my callback function looks like this.. which works.. but what if I dont want to write it to a file? What if I just want to put it into a string? How can I do that?
Thanks!
Christina
size_t CurlWrapper::write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
static int first_time=1;
char outfilename[FILENAME_MAX] = "body.out";
static FILE *outfile;
size_t written;
if (first_time) {
first_time = 0;
outfile = fopen(outfilename,"w");
if (outfile == NULL)
return -1;
fprintf(stderr,"The body is <%s>\n",outfilename);
}
written = fwrite(ptr,size,nmemb,outfile);
return written;
}
Received on 2009-01-27