D etc.c.curl examples
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 us开发者_开发知识库e. 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?
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.
精彩评论