cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to write from buffer to file

From: Ajeet kumar.S <ajeetkumar.s_at_jasmin-infotech.com>
Date: Sat, 12 Jul 2008 18:47:01 +0530

Hi all,

Thanks allot Joe N. But if we set a file pointer fp like below ;

fp= fopen("abc.txt", "w");

curl_easy_setopt(curl_handler, CURLOPT_WRITEDATA, fp);

Then it is going to copy data coming from server or out side source.

First doubt: If we have buffer like char Data_recv[10240] having some
content. If we want to write content of Data_recv[] buffer to file. How we
will write content of Data_recv[] to file using curl api.

 

Second doubt: If we have File(abc.txt). We to read this file content into
one buffer char read_data[10240].Is it possible to read using curl api.

Third API: Is correct below option:

curl_easy_setopt(curl_handler, CURLOPT_READDATA, buffer);

here char buffer[10240];

but here how curl is going to recognize to which file(file name) is going
to read.

 

Thank you.

Regards,

Ajeet Kumar singh
Received on 2008-07-12