Explorar o código

* Add error check

Michaël Van Canneyt %!s(int64=4) %!d(string=hai) anos
pai
achega
bfe3afbc62
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      packages/libcurl/examples/teststream.pp

+ 2 - 1
packages/libcurl/examples/teststream.pp

@@ -44,7 +44,8 @@ begin
       curl_easy_setopt(hCurl,CURLOPT_URL,[URL]);
       curl_easy_setopt(hCurl,CURLOPT_WRITEFUNCTION,[@DoWrite]);
       curl_easy_setopt(hCurl,CURLOPT_WRITEDATA,[Pointer(F)]);
-      curl_easy_perform(hCurl);
+      if curl_easy_perform(hCurl)<>CURLE_OK then
+        Writeln(StdErr,'Failed to get URL');
       curl_easy_cleanup(hCurl);
       end;
   Finally