cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: File write and reading using curl api

From: Joe N. <jnardone_at_gmail.com>
Date: Sat, 12 Jul 2008 08:17:38 -0400

>
> Thank you Joe N. But if we use CURLOPT_WRITEDATA , data = file_name we will
> mention. Then it will copy the data into file_name(i.e filelike abc.txt or
> any) it is possible when the data is coming from outer source(ex. like
> server etc.) But we have data in buffer like char Receive_Http[102400], we
> want to write this data into
>
> File_name(ex like abc.txt) what we can use any curl API.I think we will use
> CURLOPT_WRITEFUNCTION
>
>
> Is it right or directly using CURLOPT_WRITEDATA and CURLOPT_READDATA we can
> write data into file and read data from file.
>
>
>
> Actually I want to write the buffer data into file and similary I want to
> read file data in to a buffer using curl api.
>
Again, you need to look at the examples. Taking input from a server and
writing it to a file is a basic CURL operation. If you use the default
WRITEFUNCTION all you need to do is pass in a FILE handle to
CURLOPT_WRITEDATA and libCURL will take care of the writing to that file
as a response to your request.

Joe
Received on 2008-07-12