curl / Mailing Lists / curl-users / Single Mail


Re: Test for Return Code

From: Jeremy Nicoll <>
Date: Sun, 11 Feb 2018 13:06:54 +0000

On Sun, 11 Feb 2018, at 01:08, Mike Lambert wrote:

> CURLE_OK (0). Does this mean Curl will return an error code of 0 or do I
> have to access the variable CURLE_OK and check it.

It means you test for a return code of 0.

Curl probably issues a variety of return codes in different circumstances.
They'll be listed somewhere with their numeric values and symbolic
names. If you were using a language (eg C ?) which had been told to read
the list of symbolic names, you could test for a returned code being equal
to CURLE_OK (or any other symbolic value) and the C compiler would
know that that meant 0 (or whatever). The only advantage in that is that
program logic is possibly easier to understand when numeric error codes
are represented instead by semi-meaningful names.

Jeremy Nicoll - my opinions are my own.
Received on 2018-02-11