[fpc-pascal] How To: Use lib curl example

Michael Van Canneyt michael at freepascal.org
Tue Sep 28 10:16:34 CEST 2021



On Tue, 28 Sep 2021, Anthony Walter via fpc-pascal wrote:

> For the benefit of others, there are a few problems with the FPC example
> to note.
>
> 1) The callback CURLOPT_WRITEFUNCTION should return the number of bytes
> handled.

It does that ?

  Result:=TStream(Data).Write(Ptr^,Size*nmemb);

Write returns the number of bytes written.

> 2) You should check the result of curl_easy_perform to determine if
> the curl perform operation (HTTP GET) was successful.

I added a check.

Michael.


More information about the fpc-pascal mailing list