Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

D etc.c.curl examples

Tags:

curl

d

phobos

D, being the lesser known language of the bunch, has very little going for it in the way of libraries. I am trying to download a file, and the way I can see to do that with DMD 2 and phobos is with etc.c.curl, but... Curl is very difficult to use. And since I can not find a good example anywhere. How do you download a file in the simplest way possible using etc.c.curl?

like image 247
alexmherrmann Avatar asked Aug 21 '11 18:08

alexmherrmann


1 Answers

I don't know very much about the etc.c.curl API, which is just a binding to the C Curl library. A much easier to use D-style wrapper is currently in formal review, though, and will probably find its way into one of the next two Phobos/DMD releases. If you want to try it out in the mean time (with the understanding that there may be breaking changes to it prompted by the review process), see:

https://github.com/jcd/phobos/blob/curl-wrapper/etc/curl.d (Code)

http://freeze.steamwinter.com/D/web/phobos/etc_curl.html (Documentation)

If you don't want to use a wrapper that's this bleeding edge, you can also look at the code to it to figure out how to accomplish what you want to accomplish using the etc.c.curl C binding.

like image 109
dsimcha Avatar answered Oct 22 '22 00:10

dsimcha